Files
004_comission/_resources/it114105/itp4507/Assignment/20-21/src/WesternStyleLunchSet.java
louiscklaw 6c60a73f30 update,
2025-01-31 19:15:17 +08:00

59 lines
1.5 KiB
Java

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author JerryKwok
*/
public class WesternStyleLunchSet extends LunchSet {
public WesternStyleLunchSet(String mainDish, int price, int availableCount) {
super(mainDish, price, availableCount);
}
public String getSideDish() {
return "rice/spaghetti/French fries";
}
public static String getDrink(String drinkCode) {
String drink = "";
if (drinkCode.charAt(0) == 'i') {
drink = "Iced ";
} else {
drink = "Hot ";
}
if (drinkCode.charAt(1) == 't') {
drink += "Tea";
} else {
drink += "Coffee";
}
return drink;
}
public static String getSide(String sideCode) {
if (sideCode.equals("r")) {
return "rice";
} else if (sideCode.equals("s")) {
return "spaghetti";
} else {
return "French fries";
}
}
public String getDetails() {
return "Western style Business Set Lunch\n"
+ "main dish: " + super.getMainDish() + "\n"
+ "with " + getSideDish() + "\n"
+ "price: " + super.getPrice() + "\n"
+ "available count: " + super.getAvailableCount();
}
@Override
public LunchSetWesternStyleMemento saveMemento() {
return new LunchSetWesternStyleMemento(this);
}
}