order
unknown
java
2 years ago
1.4 kB
6
Indexable
package assignments.assignment3;
import java.util.ArrayList;
public class Order {
private String orderId;
private String tanggal;
private int ongkir;
private Restaurant restaurant;
private ArrayList<Menu> items;
private boolean orderFinished;
public Order(String orderId, String tanggal, int ongkir, Restaurant restaurant, ArrayList<Menu> items) {
this.orderId = orderId;
this.tanggal = tanggal;
this.ongkir = ongkir;
this.restaurant = restaurant;
this.items = items;
this.orderFinished = false; // Default value
}
public String getOrderId() {
return orderId;
}
public String getTanggal() {
return tanggal;
}
public int getOngkir() {
return ongkir;
}
public Restaurant getResto() {
return restaurant;
}
public ArrayList<Menu> getItems() {
return items;
}
public boolean isOrderFinished() {
return orderFinished;
}
public void setOrderFinished(boolean orderFinished) {
this.orderFinished = orderFinished;
}
public String getLokasi() {
return restaurant.getLokasi();
}
public double getTotalHarga() {
double total = ongkir;
for(Menu item : items) {
total += item.getHarga();
}
return total;
}
}
Editor is loading...
Leave a Comment