// Horspower must have a range from 200 to 700 hp and Weight must have a range from 1000 to 3000 pounds
System.out.print("\n Set horsepower (200 to 700 hp) and weight(1,000 to 3,000 pounds) (putting a space between them) of Race car 1: ");
RaceCar racer1 = new RaceCar(scan.nextDouble(), scan.nextDouble() );
How would you add a range to this?
The original RaceCar() is:
public RaceCar(double hp, double wgt)
{
horsepower = hp;
weight = wgt;
}
Aucun commentaire:
Enregistrer un commentaire