Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: You are to create a Java program for a holiday resort that rents vacation homes by the day at different rates throughout the year.

Problem:

You are to create a Java program for a holiday resort that rents vacation homes by the day at different rates throughout the year. The management also gives a 15% discount if the rental period is greater than 7 days. Renters must pay a $250 returnable deposit for each vacation home rented.

The rental rates are:

Season

Months

Charge

Spring

March, April, May

$200.00

Summer

June, July, August

$300.00

Fall

September, October, November

$250.00

Winter

December, January, February

$100.00

Sample Run (when has discount): (Items in bold represent user input.)

Welcome to Holiday Resort Vacation Home Rentals

Please enter customer information:

Enter first name: Cathy

Enter last name: Holbrook

Enter street address: 123 Main St

Enter city: Normal

Enter state: IL

Enter zip code: 61761

Enter phone number in form 9999999999: 3091239876

Enter start date in form mm/dd/yyyy: 09/28/2015

Enter number of rental homes: 2

Enter number of days: 10

Customer:

Cathy Holbrook

123 Main St

Normal, IL 61761

(309)123-9876

Rental cost: $ 5,000.00

Discount: $ 750.00

Deposit: $ 500.00

Total: $ 4,750.00

Thank you for renting from us.

Holiday Resort Vacation Home Rentals

239 E. Hwy 98

Cocoa Beach, FL 32540

(850)729-1000

Sample Run (no discount)

Welcome to Holiday Resort Vacation Home Rentals

Please enter customer information:

Enter first name: Cathy

Enter last name: Holbrook

Enter street address: 123 Main St

Enter city: Normal

Enter state: IL

Enter zip code: 61761

Enter phone number in form 9999999999: 3091239876

Enter start date in form mm/dd/yyyy: 09/28/2015

Enter number of rental homes: 1

Enter number of days: 1

Customer:

Cathy Holbrook

123 Main St

Normal, IL 61761

(309)123-9876

Rental cost: $ 250.00

Deposit: $ 250.00

Total: $ 500.00

Thank you for renting from us.

Holiday Resort Vacation Home Rentals

239 E. Hwy 98

Cocoa Beach, FL 32540

(850)729-1000

Design:

The classes should be placed in a package with the name edu.ilstu.it168.program3.

You will need to use the following classes for your program:

VacationHomeRental class

Keeps track of the information about a vacation home rental and handles calculations for the rental. It should include the following:

Constants

15 percent discount (used if the vacation home is rented for more than 7 days)

$250 returnable deposit

prices for the different seasons (see rental rates above)

Instance variables

number of days the vacation home is rented

number of vacation homes rented

rental date, entered and stored in the format mm/dd/yyyy

Methods

constructor accepting values for all instance variables

calculateTotal calculates the total cost for the rental. This is calculated by the cost of the rental(s) minus the discount amount plus the deposit.

calculateVacationHomeCost calculates the cost of the vacation home based on the number of days, number of vacation homes rented, and the season.

calculateDiscount calculates the discount

calculateDeposit determines the deposit required based on $250 per vacation home rented.

determinePrice determines the price for each rental based on month

determineDiscount determines whether there should be a discount (rental for greater than 7 days). It returns the discount percent or zero if no discount should be given.

Getters and setters for all instance variables

Customer class

Keeps track of the customer name, mailing address, and phone information.

Instance Variables

Variables for first and last names, street address, city, state, zip code, and phone.

Methods

constructor with no arguments

constructor receiving all instance variables

formatLabel method that formats the customer or resort information. This should be placed in a String to be returned from the method. See the format in the Sample Run.

formatPhone method - The phone should be entered in the form xxxxxxxxxx and formatted for display to the form (xxx)xxx-xxxx

Getters and setters for all instance variables.

You will use this class to create objects for both the resort and the customer. When an object is created for the resort, the name should be placed in the last name. You will need to add logic in formatLabel method to determine whether it is formatting for the resort or customer. For a resort object, the firstName will be null.

VacationHomeInput class

Handles all of the input from the user.

Methods

readRentalOrder this method should prompt and read all of the information for a rental. It should create and return a rental object. Use the prompts illustrated in the sample run.

readCustomer this method should read all of the information for a customer. It should create and return a customer object.

VacationHomeOutput class

Handles all output except prompts which are in the input class.

Methods (Use Sample Run for specifics)

displayGreeting welcome to the customer.

displayReceipt displays the cost of rental, discount (only display if the customer gets a discount), deposit, and total.

displayCustomer displays the customer information as formatted in the formatLabel method.

displayGoodbye thank you and resort information formatted using the formatLabel method.

VacationHomeDriver class

The driver is the class with the main method. It should first greet the customer. Then it should call readRentalOrder and readCustomer to get the required information. Output should display the customer information, the receipt, and a polite goodbye.

You will need two instances of the Customer object. One for the resort create the object and hard code the information stored in the object in the driver. The second one will be created when info about the customer is read from the user.

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

What is the orientation toward time?

Answered: 1 week ago

Question

4. How is culture a contested site?

Answered: 1 week ago