Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago