import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class 輕輕巧巧 {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
int a = 0;
int b = 0;
int c = 0;
System.out.println("請(qǐng)輸出結(jié)賬員需要接待的顧客次數(shù):");
a = Integer.parseInt(reader.readLine());
for(int i = 0; i < a; i++) {
b = 0;
do {
System.out.println("請(qǐng)輸出商品的單價(jià):");
int d = Integer.parseInt(reader.readLine());
if(d < 0) {
System.out.println("商品的單價(jià)不能小于0!");
hasMoreGoods = 1;
continue;
}
System.out.println("請(qǐng)輸入商品的數(shù)量:");
int amount = Integer.parseInt(reader.readLine());
if(d < 0) {
System.out.println("商品數(shù)量不能小于0!");
hasMoreGoods = 1;
continue;
}
totalCost = totalCost + d * amount;
System.out.println("當(dāng)前總價(jià)為:" + totalCost);
System.out.println("還有商品需要結(jié)算嗎(輸入1為有," +
"其它數(shù)字為沒(méi)有)?");
hasMoreGoods = Integer.parseInt(reader.readLine());
} while (haMoreGoods == 1);
System.out.println("本次消費(fèi)為:" + totalCost);
System.out.println("=====謝謝光臨,歡迎下次再來(lái)!=====");
}
System.out.println(serveTimes + "次結(jié)算已經(jīng)結(jié)束,結(jié)賬員可以休息啦!");
}
}
聯(lián)系客服