Ask Question

java Consider a class MotorBoat that represents motorboats. A motorboat has attributes for: The capacity of the fuel tank The amount of fuel in the tank The maximum speed of the boat The current speed of the boat The efficiency of the boat's motor The distance traveled The class has methods to: Change the speed of the boat Operate the boat for an amount of time at the current speed

+5
Answers (1)
  1. 2 February, 17:46
    0
    Below is the java code for the class MotorBoat : -

    public class MotorBoat {

    private int tankCapacity;

    private int fuelAmount;

    private double maxBoatSpeed;

    private double currentBoatSpeed;

    private double efficacy;

    private double distanceTravelled;

    public void changeSpeed (double speed) {

    currentBoatSpeed = speed;

    }

    public double operateBoat (double time) {

    distanceTravelled = currentBoatSpeed * time;

    return distanceTravelled;

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “java Consider a class MotorBoat that represents motorboats. A motorboat has attributes for: The capacity of the fuel tank The amount of ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers