自助饮品消费系统需求
代码
package selfBeverageService;
/**
* 父类,饮品类
* @author 杭杭
*
*/
public class Beverage {
private String size;
private int num;
private String note;
private String ice;
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String isIce() {
return ice;
}
public void setIce(String ice) {
this.ice = ice;
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public void showInfo() {
System.out.println("购买数量:" + this.num);
System.out.println("大小:" + this.size);
System.out.println("备注:" + this.note);
System.out.println("是否加冰:" + this.ice);
}
}
package selfBeverageService;
/**
* 可乐类
* @author 杭杭
*
*/
public class Coke extends Beverage {
private static final String name = "可乐";
private static final int price_mid = 5;
private static final int price_big = 10;
private static final int price_extraBig = 15;
@Override
public void showInfo() {
// TODO Auto-generated method stub
System.out.println("您购买了:" + Coke.name);
super.showInfo();
switch(super.getSize()) {
<