You run a vehicle rental agency. You rent three makes of cars: Ferrari, Chevy and VW, and three kinds of trucks: a pickup, a dump truck and a semi.
The interesting characteristic of cars is their max speed in mph (Ferrari – 200, Chevy – 100, VW – 75). All cars have a maximum carrying capacity of 0.5 cubic yards.
For trucks it is their carrying capacity in cubic yards that varies (pickup – 4, dump truck – 10, semi – 30). All trucks have a maximum speed of 55 mph.
An important aspect of all vehicles is their operating cost per mile (for gas, oil, etc):
Ferrari: $1.00
Chevy: $.25
VW: $.10
pickup: $.12
dump truck: $.80
semi: $1.50
All vehicles also have an insurance cost. For trucks it is simply $0.01 per cubic yard of actual cargo per mile traveled. For cars it varies with vehicle type, as follows:
Ferrari: maximum speed * miles-traveled / 1000
Chevy: 0.05 * miles-traveled
VW: 10% of total operating cost
You are to write an automated rental program. The customer will enter how much cargo she needs to carry (in cubic yards), the distance she needs to go (in miles), and how much time she has to get there (in hours). The program will present a list of suitable vehicles.
For each valid vehicle found for the given input, the program will display
the specific vehicle type
total operating cost for the trip
total insurance cost for the trip
total cost for the trip
estimated trip duration
capacity (trucks only)
speed (cars only)
The program will inform the user if there are no suitable vehicles.
Notes
The user interface will be up to you. It should be user friendly.
Your program should maintain an array of vehicles that is populated with one of each type of car and truck. Your program should service multiple users; i.e., when finished with one user, it should request input for the next.
All users should be accommodated from the same array of vehicles; assume there is an infinite supply of all vehicle types.
Your vehicles should have a method that returns, as a string, all information pertaining to a trip. Your program should loop through the array of vehicles and, for each one valid for the trip, print the information returned by the method.
Use good OOP design. Use good programming technique and style, including constants instead of literals.
Turn In
The first step is your design. You must draw a picture of your programs design, using good OOP principles. Each class should include the fields, methods and constants, and whether it is concrete or abstract.
The second step is to implement the design. Please zip your .java files