-2
所以,我有以下类:被抛出一个愚蠢的支架错误。还不清楚如何继续
public class Vehicle
{
private double horsepower;
private double weight;
private double topspeed;
public Vehicle (double HP, double Heavy, double TSpeed)
{
horsepower = HP;
weight = Heavy;
topspeed = TSpeed;
}
//public double Consumption
}
。
public class SportCar extends Vehicle
{
public double aerodynamic;
public void Aero
{
aerodynamic = 0.5;
}
}
。
public class TestConsumption
{
public static void main(String[] args)
{
Vehicle first = new Vehicle(200, 1500, 220);
Vehicle second = new Vehicle(100, 1000, 170);
Vehicle third = new Vehicle(135, 1100.2, 173);
}
}
而且我报错,说看起来说'('
预计SportCar类的第五行的错误。我不知道为什么它给出这个错误,所以我超级卡住了。
此外,我试图使用公式中的马力,重量,顶部和空气动力学特性来提供消耗值。我不确定到目前为止我所做的工作要走向何方 - 任何提示都将不胜感激。
您的'Aero'方法声明中缺少'()'。 – rgettman
而你错过了SportCar类的构造函数? – MaxZoom
只有在每个帖子保持一个问题的情况下,它才能真正起作用。 – Teepeemm