📄 apple.java
字号:
package problem_11_1;
//Apple.java
public class Apple {
private double weight; //重量
private double sugarAmount; //含糖量
private double vitaminAmount; //含维生素量
public Apple(double weight){
this.weight = weight;
sugarAmount = 0.15 * weight; //默认苹果含糖率为0.15
vitaminAmount = 0.00005 * weight; //默认苹果含维生素率为0.000005
}
//返回含糖量
public double getSugarAmount(){
return sugarAmount;
}
//返回含维生素量
public double getVitaminAmount(){
return vitaminAmount;
}
//返回重量
public double getWeight(){
return weight;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -