📄 exercise 3.coffeebrewer.java
字号:
/**
* This class models a coffee brewer. It extends class Product.
*
* @author Neil
* @version 1.0.0
* @see Product
*/
public class CoffeeBrewer extends Product {
private String model;
private String waterSupply;
private int numberOfCups;
/**
* Getter of the property <tt>model</tt>
*
* @return Returns the model.
*
*/
public String getModel() {
return model;
}
/**
* Getter of the property <tt>waterSupply</tt>
*
* @return Returns the waterSupply.
*
*/
public String getWaterSupply() {
return waterSupply;
}
/**
* Getter of the property <tt>numberOfCups</tt>
*
* @return Returns the numberOfCups.
*
*/
public int getNumberOfCups() {
return numberOfCups;
}
/**
* Constructor that initializes the instance variables code, description,
* price, model, waterSupply, and numberOfCups.
*
* @param initialCode
* @param initialDescription
* @param initialPrice
* @param initialModel
* @param initialWaterSupply
* @param initialNumberOfCups
*/
public CoffeeBrewer(String initialCode, String initialDescription,
double initialPrice, String initialModel,
String initialWaterSupply, int initialNumberOfCups) {
super(initialCode, initialDescription, initialPrice);
model = initialModel;
waterSupply = initialWaterSupply;
numberOfCups = initialNumberOfCups;
}
/**
* Overrides the method toString in the class Object.
*
* @return Returns the string representation of a CoffeeBrewer object. The
* String returned has the following format:
* <tt>code_description_price_model_waterSupply_numberOfCups</tt>
*
*/
public String toString() {
return code + "_" + description + "_" + price + "_" + model + "_"
+ waterSupply + "_" + numberOfCups;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -