Question: 1. Create a new Java Project 2. Create a class named CabinRental that includes an integer field for the cabin number and an int field

1. Create a new Java Project

2. Create a class named CabinRental that includes an integer field for the cabin number and an int field for the weekly rental rate.

3. Include get methods for these fields and a constructor that requires an integer argument representing the cabin number.

4. The constructor sets the weekly rate based on the cabin number. Cabins numbered 1, 2, and 3 are $950 per week, and others are $1,100 per week.

5. Create an extended class named HolidayCabinRental that is used for rentals during weeks that include summer holiday weekends. The constructor for this class requires a cabin number and adds a $150 surcharge to the regular rental rate.

6. Write an application named DemoCabinRental that creates an object of each class, and demonstrate that all the methods work correctly. Save the three files.

Sample Output:

Low cabin #2 rate $950

High cabin #4 rate $1,100

Low holiday #2 rate $1,100

High holiday #4 rate $1,250

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!