Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a class named RentalCar that has the following attributes: yearModel- This field is an integer that holds the car's year model. make- This field

Write a class named RentalCar that has the following attributes:

yearModel- This field is an integer that holds the car's year model.

make- This field references a String object that holds the make of the car.

plateNumber- This field references a String object that holds the car's plate number.

rentalPrice- This field is a double that holds car's rental rate.

In addition, the class should have the following constructor and other methods:

Constructor - The constructor should accept the car's year model, make and plate number as arguments. These values should be assigned to the objects yearModel, make and plateNumber fields. The constructor should also assign 2000 to the rentalPrice field.

Accessors - Appropriate accessor methods should get the values stored in an object's yearModel, make, plateNumber and rentalPrice fields.

A method named payment() to calculate and return the total payment for the car rental. To get the total payment, you can use the following formula:

total payment-(2 price) -(2 x rental price x(10% discount))

Write a java application named RentalCarDemo to demonstrate RentalCar class. Prompt the user to input all the details needed. Then calculate and display the total payment.

Example of the program output is given below:

One World Auto Rental

Year model 2010

Make Porsche

Plate Number wW 2011

T Rental price is RM2000,00

Rental days is fixed as 2 day and discount is 10%

Total Pavnent is RM1600 00

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

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions