Question: Java programming. The first pic is the question and details, please dont miss any of the details. Thanks a lot! Program 3 (50 points): For
Java programming.
The first pic is the question and details, please dont miss any of the details. Thanks a lot!


Program 3 (50 points): For this part of the assignment, yo l create two files: one that contains the definition of a MotorBoat class and one that contains the main method and tests the MotorBoat class. Here are the specifications Create a class MotorBoat with the following attributes .The capacity of the fuel tank (measured in gallons) . The amount of fuel in the tank (measured in gallons) . The maximum speed of the boat (measured in miles per hour) .The current speed of the boat (measured in miles per hour) . The efficiency of the boat motor (measures how many gallons are needed to travel one mile) . The distance traveled (measured in miles) Your class should implement the following methods: . A constructor that takes three arguments that represent a boat's tank capacity, maximum speed, and motor efficiency. All other attributes should be set to Inspector methods that return the values of distance traveled, current speed, amount of fue in the tank, maximum speed, and tank capacity .A method that allows you to refuel the boat with some amount of fue .A method to change the speed of the boat. .A method that allows you to operate the boat for an amount of time at the current speed. Keep in mind that when you operate the boat, you will travel a certain distance (distance traveled time travel * speed), and in doing so, you will consume fuel. Both of those attributes will need to be updated by this method. Test your MotorBoat class by taking it through the following steps: . Create a MotorBoat. Set up the tank capacity, maximum speed and efficiency to some suitable values. You can use these values for testing purposes: 50-gallon tank, 90 mph max speed, and 0.43 gallons per mile; or come up with your own set of values. . Put some fuel in the tank do not exceed the maximum capacity . Set up a current traveling speed do not exceed maximum speed Operate the boat for a certain amount of time, then display how long you have traveled, the distance traveled, and how much fuel you have left in the tank . Decide if you need to add more fuel to the tank before heading back, and do so if necessary
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
