/** javaのプログラム 例題3 データの集計 */ import java.io.*; class r3t { public static void main (String[] args) throws IOException { BufferedReader in = new BufferedReader (new InputStreamReader(System.in)); double t,s,k,gokei; gokei = 0; System.out.print("単価を入力: "); t = (new Double(in.readLine())).doubleValue(); while ( t != 0 ) { System.out.print("数量を入力: "); s = (new Double(in.readLine())).doubleValue(); k = t * s; System.out.println ("単価 " + t + " 数量 " + s + " 金額 " + k); System.out.println(); gokei = gokei + k; System.out.print("単価を入力: "); t = (new Double(in.readLine())).doubleValue(); } System.out.println(); System.out.println("金額の合計 " + gokei); System.out.print("実行終了"); } }