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 • Refuel the boat with some amount of fuel • Return the amount of fuel in the tank • Return the distance traveled so far If the boat has efficiency e, the amount of fuel used when traveling at a speed s for time t is e × s2 × t. The distance traveled in that time is s × t. a. Write a method heading for each method. b. Write preconditions and postconditions for each method. c. Write some Java statements that test the class. d. Implement the class.

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter20: Queuing Theory
Section: Chapter Questions
Problem 17RP
icon
Related questions
Question

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
• Refuel the boat with some amount of fuel
• Return the amount of fuel in the tank
• Return the distance traveled so far
If the boat has efficiency e, the amount of fuel used when traveling
at a speed s for time t is e × s2 × t. The distance traveled in that time
is s × t.
a. Write a method heading for each method.
b. Write preconditions and postconditions for each method.
c. Write some Java statements that test the class.
d. Implement the class.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole