Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 the(vehicle 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 and(adds 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 date1 and date2, y
ou can
use
the following call, which returns a long value
:
java.time.temporal.ChronoUnit.DAYS.between(
date1
,
date2
)
;
Sample Run of Program
Available vehicles:
1 COMPACT Toyota Yaris
-
Daily rate: $50.0
2 TRUCK with cargo capacity: 8500.0kg. Ford F150
-
Daily
rate: $120.0
3 PREMIUM BMW 750i
-
Daily rate: $280.0
Pick a vehicle by entering its number:
1
Please enter the pick up date:
Please enter year:
2023
Please enter month:
4
Please enter day:
28
Please enter the drop off date:
Please enter year:
2023
Please enter month:
5
Please enter day:
3
Rented vehicle:
COMPACT Toyota Yaris
-
Daily rate: $50.0
Pick up date: 2023
-
04
-
28
Drop off date: 2023
-
05
-
03
Rental rate: $250.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Third International Conference Achids 2011 Daegu Korea April 2011 Proceedings Part 2 Lnai 6592

Authors: Ngoc Thanh Nguyen ,Chong-Gun Kim ,Adam Janiak

2011th Edition

3642200419, 978-3642200410

More Books

Students also viewed these Databases questions

Question

The nature and importance of the global marketplace.

Answered: 1 week ago