Question: 1- Create new java package inside the project and name it cars_pkg . (0.5m) 2- Add new class to the cars_pkg and name it Car.

1- Create new java package inside the project and name it cars_pkg. (0.5m)

2- Add new class to the cars_pkg and name it Car. (1m)

3- Add the following attributes (member variables): to the Car class

Plate_no, type and rent (type attribute can take values like small, CVS, or family). (1m)

4- Attributes should be encapsulated within the class. (2m)

5- Add a constructor to the class that initialize all variables. (1m)

6- Add calculate_rent() method to Car class. the method should take one integer parameters (day) and return Rent * day. (1m)

7- Add display method to car class that print all details on one line (2m)

8- In the main program:

a. Create an instance of the Car class. (2m)

b. Call the calculate_rent () for 5 days and display details of the car. (1m)

c. The main program should handle All Exception (0.5m)

9- Add some comments to your program. (0.5m)

10- Test your program. (0.5m)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!