Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java, task1: Create a class called Hotel that includes: numberOfRooms (int). It can be accessed in any class. In addition, it's value cannot be changed

java, task1: Create a class called Hotel that includes:

numberOfRooms (int). It can be accessed in any class. In addition, it's value cannot be changed during the run, and this value will be shared by all objects.

numberOfReservedRooms (int). It can be accessed by this class only, and its value will be shared by all objects.

numberOfAvailableRooms (int). It can be accessed by this class only, and its value will be shared by all objects.

A constructor receives the numberOf WantedRoomsToReserve and:

Increase the reserved rooms

Decrease the available rooms

Constructor with no-arg to invoke the first constructor and:

Increase the reserved rooms by 1.

Decrease the available rooms by 1.

Getters for the required variables.

Task 2: Create an Employee class includes two methods: getAvailablity and main methods.

getAvailable

This method receives the number of wanted rooms, and return true according to the NumberOfAvailableRooms. If the available rooms greater than or equal to the customer request. Otherwise, it will return false.

main

Create a Hotel object using the no-arg constructor.

Ask the user to enter the number of wanted rooms, and check if the customer can reserve these rooms or not using getAvailabilty method.

If this number of rooms is available, create an object to reserve rooms for the costumer.

Task3: Print all Hotel information

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

Modern Database Management

Authors: Donald A. Carpenter Fred R. McFadden

1st Edition

8178088045, 978-8178088044

More Books

Students also viewed these Databases questions