Question: Hi, in java please I need help quickly. Define a Java class named Hotel that has the following 1.) Four properly encapsulated variables: name of

Hi, in java please I need help quickly.

Define a Java class named Hotel that has the following

1.) Four properly encapsulated variables: name of type String, address of type String,

nFloors of type int, and avePrice of type double.

2.) A no-arg constructor that sets name to "Hotel 1", address to "17 N NEIU, Chicago",

nFloors to 20, and avgPrice to 110.5.

3.) A constructor that takes four parameters and sets the four instance variables

accordingly.

4.) A getter and a setter method for the instance variable avgPrice.

5.) An instance method named toString that does not take any parameter and returns a

value of type String. The returned value contains the four instance variables of this

object in a format of your choice.

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!