FoodOrder Customer OrderApp -orderNumber: long -name: String 1 +main(args: String): void +addltem(i: Menultem) +getTotalCost(): double +chargeCreditCard(): void Menultem +name: String #price: double +getPrice(): double ComboMeal -discount: double +getPrice(): double +addltem(i: Menultem): void
I wrote my codes like this:
public class OrderApp {
public void main(String[] args) {
FoodOrder foodOrder;
}
}
public class Customer {
private String name;
public void chageCrditCard() {
}
}
public class FoodOrder {
Customer customer;
private long orderNumber;
public void addItem (MenuItem i) {
}
public double getTotalCost() {
return 0.00;
}
}
public class MenuItem {
public String name;
protected double price;
public double getPrice() {
return price;
}
}
public class ComboMeal extends MenuItem {
private double discount;
public double getPrice() {
return price;
}
public void addItem (MenuItem i) {
}
}
I'm not sure If I did the relationship between classes and implement each one right. Also, how do I express multiplicities and specifiers in the codes? And finally, please review the whole thing.
Subject: Java Programming
Trending now
This is a popular solution!
Step by step
Solved in 2 steps