📄 pizza.java
字号:
package PizzaProduct;
import java.util.*;
import java.sql.*;
/**
* @author Administrator
*
*/
public class Pizza {
private String pizzaid;
private String name;
private String type;
private String size;
private String topping;
private String instore;
private Timestamp begintime;
private Timestamp finishtime;
private String[] toppings=new String[3];
private int routines;
private int price;
private int numberoftopping;
public Pizza(){
;
}
public Pizza(String name,String type,String size,String topping){
this.name = name;
this.type=type;
this.size=size;
this.topping = topping;
}
public String getPizzaid() {
return pizzaid;
}
public void setPizzaid(String pizzaid) {
this.pizzaid = pizzaid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getInstore() {
return instore;
}
public void setInstore(String instore) {
this.instore = instore;
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public String getTopping() {
return topping;
}
public void setTopping(String topping) {
this.topping = topping;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public int getRoutines() {
return routines;
}
public void setRoutines(int routines) {
this.routines = routines;
}
public String[] getToppings() {
return toppings;
}
public void setToppings(String[] toppings) {
this.toppings = toppings;
}
public Timestamp getBegintime() {
return begintime;
}
public void setBegintime(Timestamp begintime) {
this.begintime = begintime;
}
public Timestamp getFinishtime() {
return finishtime;
}
public void setFinishtime(Timestamp finishtime) {
this.finishtime = finishtime;
}
public String toString(){
return "Pizza: Name:"+name+", Type:"+type+", Size:"+size+", Topping:"+topping;
}
public void toppingTotoppings(){
int i=0;
StringTokenizer st = new StringTokenizer(topping,",",false);
while(st.hasMoreElements())
{
toppings[i] =(String)st.nextToken();
i++;
}
numberoftopping=i;
}
public void computePrice(){
price=0;
if(name.equals("Seafood")){
price=price+40;
}
else
price=price+30;
this.toppingTotoppings();
price=price+(3*numberoftopping);
if(routines == 3){
price=price+2;
}
else if(routines ==10 ){
price=price-2;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -