Commit 8a30a4b9 authored by 9731050's avatar 9731050

2th

parent d520b22e
Pipeline #407 canceled with stages
......@@ -4,7 +4,7 @@ public class Order {
private int id;
private Customer customer;
private Food[] foods;
private int price;
private double price;
public Order(int id, Customer customer, Food[] foods) {
this.id = id;
......@@ -13,10 +13,8 @@ public class Order {
for (Food food : foods) {
price += food.getPrice();
System.out.println("price="+price);
}
price *= 1.4;
System.out.println("price2="+price);
customer.setOrder(this);
}
......@@ -24,7 +22,7 @@ public class Order {
return foods;
}
public int getPrice() {
public double getPrice() {
return price;
}
......@@ -35,8 +33,12 @@ public class Order {
}
for (int i = 0; i < amount; i++) {
temp[foods.length + i] = food;
// System.out.println("s="+price);
// System.out.println("f="+getPrice());
price=price+(temp[foods.length+i].getPrice())*1.4;
}
foods = temp;
temp = null;
}
......
......@@ -82,8 +82,9 @@ public class Restaurant {
}
public void acceptPayment(Customer customer) {
int menuCost = customer.getOrder().getPrice();
double menuCost = customer.getOrder().getPrice();
currentCustomers.remove(customer);
fund += menuCost * 0.9;
totalNumOfFood += customer.getOrder().getFoods().length;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment