Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in Java Write a class named Beach that has the following instance variables: hotelName. A String object that holds the name of the hotel city.

in Java Write a class named Beach that has the following instance variables: hotelName. A String object that holds the name of the hotel city. A String variable that holds the name of the city where you are staying numDays the number of days you are staying cost the cost of the vacation The class should have the following three constructors. Even though we do not use all three in our specific example, you still need to include them. Remember this is a blueprint that can be used in many applications. Other applications might use the other constructor): A no-argument constructor A full constructor that has parameters for all four fields (also called instance variables) A constructor that takes in the first two fields. (This method will only have two items in the parentheses in the signature see Employee for an example) Write your toString() and your getters and setters (which should always be placed at the bottom).

Write a driver program named BeachDriver that creates the following three trips by calling the appropriate constructor. Have it print each of them out by calling the toString() method. Then call the setters to set the last trips cost to 1800 and the number of days to 7. Print it out again. image text in transcribed SEE SAMPLE FOR THE OUTPUT BELOW image text in transcribed

Hotel Name Hilton Marriott InterContinental City Myrtle Beach San Diego Miami Beach Number of Days 4 10 Cost $560 $1200 BeachDriver.java You are staying at the Hilton in Myrtle Beach for 4 days for a cost of $560.00 You are staying at the Mariott in San Diego for 10 days for a cost of $1,200.00 You are staying at the Intercontinetal in Miami for 0 days for a cost of $0.00 You are staying at the Intercontinetal in Miami for 7 days for a cost of $1,800.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

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago