coffee.java

来自「ssd3 java程序练习 exercise 3 绝对没有问题」· Java 代码 · 共 63 行

JAVA
63
字号

public class Coffee extends Product {
	private String origin; //The origin of the coffee 
	private String roast; //The roast of the coffee 
	private String flavor; //The flavor of the coffee 
	private String aroma; //The aroma of the coffee 
	private String acidity; // The acidity of the coffee 
	private String body; //The body of the coffee 
	
	public Coffee (){
		
	}
	public Coffee (String initialCode,
            String initialDescription,
            double initialPrice,
            String initialOrigin,
            String initialRoast,
            String initialFlavor,
            String initialAroma,
            String initialAcidity,
            String initialBody){
	super(initialCode,initialDescription,initialPrice);
	this.origin = initialOrigin;
	this.roast = initialRoast;
	this.flavor = initialFlavor;
	this.aroma = initialAroma;
	this.acidity = initialAcidity;
	this.body = initialBody;
	}
	
	public String getOrigin(){
		return this.origin;
	}//. Returns the value of instance variable origin. 
	
	public String getRoast(){
		return this.roast;
	}//. Returns the value of instance variable roast. 
	
	public String getFlavor(){
		return this.flavor;
	}//. Returns the value of instance variable flavor. 
	
	public String getAroma(){
		return this.aroma;
	}//. Returns the value of instance variable aroma. 
	
	public String getAcidity(){
		return this.acidity;
	}//. Returns the value of instance variable acidity. 
	public String getBody(){
		return this.body;
	}//. Returns the value of instance variable body. 
	
	public String toString(){
		return super.toString()+"_"+getOrigin()+"_"+
		getRoast()+"_"+getFlavor()+"_"+
		getAroma()+"_"+getAcidity()+"_"+
		getBody();
	}


}

⌨️ 快捷键说明

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