📄 vehicle.java
字号:
public class Vehicle
{
private double load,maxLoad;
public Vehicle(double maxLoad)
{
this.maxLoad=kiloToNewts(maxLoad);
}
public double getLoad()
{
return newtsToKilo(load);
}
public double getMaxLoad()
{
return newtsToKilo(this.maxLoad);
}
public boolean addBox(double weight)
{
boolean f;
if (this.load+kiloToNewts(weight)>this.maxLoad)
f=false;
else
{
f=true;
this.load=this.load+kiloToNewts(weight);
}
return f;
}
private double newtsToKilo(double weight)
{
return (weight*9.8);
}
private double kiloToNewts(double weight)
{
return (weight/9.8);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -