你可以写一个BILL类么
Class BIll {
private String itemname;
private int Quantity;
private double price;
public Bill(String itemname,int Quantity,double price){
this.itemname=itemname;
this.Quantity=Quantity;
this.price=price;
}
public double total(){}
public void show(){}
}
大概就这样子,可以极大的简化编程,而且面向对象么
我都没看懂你这程序啥意思????你要loop重复三次?loop在哪呢?它又是什么意思呢?你想要简单重复这样不就行了?do { int loop = 0; item1 = (new Scanner(System.in)).nextLine(); loop ++;}while(loop < 3);