Question: I tired run this small code but ending up the errors I went the code and didn't find any problem. Please help the finding bug

I tired run this small code but ending up the errors I went the code and didn't find any problem. Please help the finding bug and fix the error

public class Lesson8 {

public static void main(String[] args) {

aircraft cessna172 = new aircraft(); // creates object of class aircraft

aircraft piperSaratoga = new aircraft();

cessna172.passengers = 4;

cessna172.cruiseSpeed = 140;

cessna172.fuelCapacity = 56.5;

cessna172.fuelBurnRate = 9.5;

piperSaratoga.passengers = 6;

piperSaratoga.cruiseSpeed = 201;

piperSaratoga.fuelCapacity = 102.5;

piperSaratoga.fuelBurnRate = 20.5;

System.out.println("Cessna 172 Endurance is: " + cessna172.calulateEndurance());

double enduranceSaratoga = piperSaratoga.calulateEndurance();

System.out.println(" Piper Saratogs Endurance is: " + enduranceSaratoga);

}

}

class aircraft {

int passengers; // number of people

int cruiseSpeed; // miles per hour

double fuelCapacity; // gallons

double fuelBurnRate; // gallons per hour

//Method to calculate aircraft endurance

double calulateEndurance() {

double endurance;

endurance = fuelCapacity / fuelBurnRate;

return endurance;

}

}

I tired run this small code but ending up the errors I

public class Lesson8 { public static void main(String[] args) { aircraft cessna 172 = new aircraft(); // creates object of class aircraft aircraft piperSaratoga = new aircraft(); Cessna 172. passengers = 4; cessna 172.cruiseSpeed = 140; cessna 172. fuelCapacity = 56.5; cessna 172. fuelBurnRate = 9.5; piperSaratoga. passengers = 6; piperSaratoga.cruiseSpeed = 2017 piperSaratoga. fuelCapacity = 102.5; piperSaratoga. fue lBurnRate = 20.5; System.out.println("Cessna 172 Endurance is: " + cessna172.calulateEndurance()); double enduranceSaratoga = piperSaratoga.calulateEndurance(); System.out.println(" Piper Saratogs Endurance is: " + enduranceSaratoga); 33 234 35 X36 class aircraft { int passengers; int cruise Speed; double fuelCapacity; double fuelBurnRate; // number of people // miles per hour // gallons // gallons per hour 37 38 //Method to calculate aircraft endurance 42 double calulateEndurance() { double endurance; endurance = fuelCapacity / fuelBurnRate; return endurance

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!