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

📄 coffee.java

📁 ssd2 exercise3 的题目和答案
💻 JAVA
字号:
/**
 * This class maintains the attributes and methods of the Coffee.
 *
* @author Luorenhu
 * @version  1.0.0
 */
public class Coffee extends Product
{

    /* origin */
    private String origin;
    
    /* roast */
    private String roast;
    
    /* flavor */
    private String flavor;
    
    /* aroma */
    private String aroma;
    
    /* acidity */
    private String acidity;
    
    /* body */
    private String body;
    
    /**
	 * Constructs an <code>Coffee</code> object.
	 *
	 * @param initialCode  a string with the code of the coffee.
	 * @param initialDescription  a string that describes the coffee.
	 * @param initialPrice  a double that represents the price of the coffee.
	 * @param initialOrigin  a string with the origin of the coffee.
	 * @param initialRoast  a string with the roast of the coffee.
	 * @param initialFlavor  a string with the flavor of the coffee.
	 * @param initialAroma  a string with the aroma of the coffee.
	 * @param initialAcidity  a string with the acidity of the coffee.
	 * @param initialBody  a string with the body of the 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);
        origin = initialOrigin;
        roast = initialRoast;
        flavor = initialFlavor;
        aroma = initialAroma;
        acidity = initialAcidity;
        body = initialBody;
    }
    
    /**
	 * Returns the origin of the coffee.
	 *
	 * @return  origin of the coffee.
	 */
    public String getOrigin()
    {
        return origin;
    }
	
	/**
	 * Returns the roast of the coffee.
	 *
	 * @return  roast of the coffee.
	 */
    public String getRoast()
    {
        return roast;
    }
	
	/**
	 * Returns the flavor of the coffee.
	 *
	 * @return  flavor of the coffee.
	 */
    public String getFlavor()
    {
        return flavor;
    }
	
	/**
	 * Returns the aroma of the coffee.
	 *
	 * @return  aroma of the coffee.
	 */
    public String getAroma()
    {
        return aroma;
    }
	
	/**
	 * Returns the acidity of the coffee.
	 *
	 * @return  acidity of the coffee.
	 */
    public String getAcidity()
    {
        return acidity;
    }
	
	/**
	 * Returns the body of the coffee.
	 *
	 * @return  body of the coffee.
	 */
    public String getBody()
    {
        return body;
    }
	
	/**
	 * Returns the string representation of this <code>Coffee</code>
	 * object (overrides the {@link Object#toString()} method).
	 *
	 * @return  the string representation of this <code>Coffee</code>
	 *          object.
	 */
    public String toString()
    {
        String message = super.toString() + "_" + getOrigin() + "_" + getRoast() + "_" + getFlavor() + "_" + getAroma() + "_" + getAcidity() + "_" + getBody();
        return message;
    }
}

⌨️ 快捷键说明

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