Files
004_comission/_resources/it114105/itp4510/Lab01/Lab1.2/q1/Drink.java
louiscklaw 6c60a73f30 update,
2025-01-31 19:15:17 +08:00

19 lines
416 B
Java

public class Drink extends Food {
protected int volume;
public Drink(String name, int price, int volume) {
super(name, price);
this.volume = volume;
}
public void setPrice(int price) {
if (price < 5)
this.price = 5;
else
this.price = price;
}
public String toString() {
return super.toString() + ", volume=" + volume;
}
}