coffeebrewer.java

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

JAVA
40
字号
import com.sun.org.apache.regexp.internal.recompile;


public class CoffeeBrewer extends Product {
	private String model; //The model of the coffee brewer 
	private String waterSupply; //The water supply (Pour-over or Automatic) 
	private int numberOfCups; //The capacity of the coffee brewer 
	
	public CoffeeBrewer(){}
	
	public CoffeeBrewer(String initialCode, 
            String initialDescription, 
            double initialPrice,
            String initialModel,
            String initialWaterSupply,
            int initialNumberOfCups){
		super(initialCode, initialDescription, initialPrice);
		this.model = initialModel;
		this.waterSupply = initialWaterSupply;
		this.numberOfCups = initialNumberOfCups;
	}
	
	public String getModel(){
		return this.model;
	}//. Returns the value of instance variable model. 
	
	public String getWaterSupply(){
		return this.waterSupply;
	}//. Returns the value of instance variable waterSupply. 
	
	public int getNumberOfCups(){
		return this.numberOfCups;
	}//. Returns the value of instance variable numberOfCups. 
	
	public String toString(){
		return super.toString()+"_"+getModel()+"_"+
		getWaterSupply()+"_"+getNumberOfCups();
	}
}

⌨️ 快捷键说明

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