資源簡介
自制咖啡售賣系統包含零錢計算并輸出計算結果僅供學習
代碼片段和文件信息
package?CoffeeSale;
import?java.util.Scanner;
abstract?class?Coffee{
private?int?CarNum=0;
protected?int?AllPrice=0;
//商品種類
private?String?coffee[][]={{“1““雀巢咖啡“}{“2““藍山咖啡“}{“3““貓屎咖啡“}};
//商品對應價格
private?int[]?price={81215};
public?abstract?int?coffeBuy();
public?void?setCarNum(int?carNum)?{
CarNum?=?carNum;
}
public?int?getCarNum()?{//獲取購物車商品數
return?CarNum;
}
public?void?setAllPrice(int?allPrice)?{
AllPrice?=?allPrice;
}
public?int?getAllPrice()?{//獲取購物車總價
return?AllPrice;
}
public?void?setCoffee(String?coffee[][])?{//獲取咖啡信息
this.coffee?=?coffee;
}
public?String[][]?getCoffee()?{
return?coffee;
}
public?void?setPrice(int[]?price)?{
this.price?=?price;
}
public?int[]?getPrice()?{//獲取咖啡價格
return?price;
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????1843??2017-12-24?19:53??CoffeeSale\CoffeeBuy.java
?????文件?????????898??2017-12-24?19:53??CoffeeSale\SaleMain.java
?????文件????????3936??2017-12-24?19:53??CoffeeSale\giveMoney.java
?????目錄???????????0??2017-12-24?19:53??CoffeeSale\
評論
共有 條評論