⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pizza.java

📁 java编的销售系统
💻 JAVA
字号:

public class Pizza
{
	private PizzaType pizzaType;
	private String baseType;
	private int size;
	private Topping toppings;
	private BakeSpeed bakeSpeed;
	private int quantity;
	
	public Pizza(PizzaType aPizzaType,String aBaseType, int aSize, Topping aToppings, 
		BakeSpeed aBakeSpeed, int aQuantity)
	{
		pizzaType=aPizzaType;
		baseType = aBaseType;
		size = aSize;
		toppings = aToppings;
		bakeSpeed = aBakeSpeed;
	    quantity = aQuantity;
	}
	
	//get base type 
	public String getBaseTypeName()
	{
		return baseType;
	}
	
	//set and get size
	public void setSize(int aSize)
	{
		size = aSize;
	}
	
	public int getSize()
	{
		return size;
	}
	
	//add toppings
	public void setTopping(Topping aToppings)
	{
		toppings = aToppings;
	}
	
	public String getToppingName()
	{
		return toppings.getToppName();
	}
	
	public int getToppingPrice()
	{
		return toppings.getToppPrice();
	}
	
	//add Bake Speed and get bake speed name and bake speed price
	public void setBakeSpeed(BakeSpeed aBakeSpeed)
	{
		bakeSpeed = aBakeSpeed;
	}
	
	public String getBakeSpeedName()
	{
		return bakeSpeed.getClass().getName();
	}
	
	public int getBakeSpeedPrice()
	{
		return bakeSpeed.getBakePrice();
	}
	
	//get quantiyty
	public int getQuantity()
	{
		return quantity;
	}
	
	public PizzaType getPizzaType()
	{
		return pizzaType;
	}
	
	public int getPrice()
	{
		return (this.getBakeSpeedPrice()+this.getToppingPrice()+this.getPizzaType().getPrice())*quantity;
	}
	
	public String toString()
	{
		return pizzaType.getTypeName()+ "  ,  " 
			+getBaseTypeName() + " , "
			+getSize() + "  ,  "
			+getToppingName() + " , "
			+getBakeSpeedName() + " , "
			+getQuantity() + "\n";
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -