Write an application that implements a trip-time calculator. Define and use a class TripComputer to compute the time of a trip. TripComputer should have the private attributes
• totalTime—the total time for the trip
• restStopTaken—a boolean flag that indicates whether a rest stop has been
taken at the end of the current leg and the following methods:
• computeLegTime(distance, speed)—computes the time for a leg of the trip
having a given distance in miles and speed in miles per hour. If either the distance or the speed is negative, throws an exception.
• takeRestStop(time)—takes a rest stop for the given amount of time. If the
time is negative, throws an exception. Also throws an exception if the client
code attempts to take two rest stops in a row.
• getTripTime—returns the current total time for the trip.
This structure of this project is similar to project 9. Even though the class TripComputer is pretty simple, developing and testing it first is advisable.
See the code in TripComputerException.java, TripComputer.java, TripComputerApp.java.
You might also like to view...
3. The main work of the ________ is to build an index.
Fill in the blank(s) with the appropriate word(s).
The following pseudocode is an example of a(n) ____ structure. get firstNumber get secondNumber add firstNumber and secondNumber print result
A. decision B. task C. selection D. sequence
Which firewall architecture combines the packet-filtering router with a separate, dedicated firewall, such as an application proxy server?
A. Screened subnet firewall B. Dual-homed host C. Proxy server D. Screened host firewall
Case-Based Critical Thinking Questions Case 6-1 Cayden is creating a Photo Album in PowerPoint 2016 to show at his sister's wedding. ? Once Cayden is on the right tab, he chooses the ____ group, and clicks the Photo Album button to open the Photo Album dialog box.
A. Group B. Images C. Share D. Portfolio