Question: I need a java program which Implement a simple program for a car rental program needs to consist of the following parts: insome An abstract
I need a java program which Implement a simple program for a car rental program needs to consist of the following parts: insome An abstract class Vehicle which stores thevehicle model and rental rate, as well as a public method getDescription that returns a description of the vehicle A class Car that inherits from Vehicle and adds an Enumeration for the size of the car with possible values compact, midsize, fullsize and premium A class Truck that inherits from Vehicle andadds a cargo capacity A class Rental that contains a Vehicle, a LocalDate for the pick up date and a LocalDate for the drop of date for the rental. It also needs to contain a method that calculates the total price of the rental by multiplying the number of days by the rate and a method that returns a description of the rental, which includes the total price. A class Midterm with a main method that o Creates an array of three Vehicle objects using the data shown in the sample run below o Prompts users to pick a vehicle, enter a pick up date and a drop off date o Creates a Rental object with that information and outputs its description.
Hint:
To calculate the number of days between
two
LocalDate objects date and date y
ou can
use
the following call, which returns a long value
:
java.time.temporal.ChronoUnit.DAYS.between
date
date
;
Sample Run of Program
Available vehicles:
COMPACT Toyota Yaris
Daily rate: $
TRUCK with cargo capacity: kg Ford F
Daily
rate: $
PREMIUM BMW i
Daily rate: $
Pick a vehicle by entering its number:
Please enter the pick up date:
Please enter year:
Please enter month:
Please enter day:
Please enter the drop off date:
Please enter year:
Please enter month:
Please enter day:
Rented vehicle:
COMPACT Toyota Yaris
Daily rate: $
Pick up date:
Drop off date:
Rental rate: $
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
