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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started