Create a class called ‘room’ to describe a hotel room. the class has the following attributes – an integer called ‘sleeps’ to describe how many people can sleep in the room.

Responsive Centered Red Button

Need Help with this Question or something similar to this? We got you! Just fill out the order form (follow the link below), and your paper will be assigned to an expert to help you ASAP.

This is a reminder of C++ assignment. You will be asked to write one or more classes and
then use those classes in a driver program.
Please pay attention to the archive type that is acceptable for submission. As an additional
requirement you must submit a capture of the terminal that you compile and
subsequently run your program (see TIPS for my sample capture).
Class room
Create a class called ‘room’ to describe a hotel room. the class has the following attributes
– an integer called ‘sleeps’ to describe how many people can sleep in the room.
default value is 1 and acceptable values are between 1 and 4.
– a boolean called ‘occupied’ to describe if the room is free (occupied = false) or not.
default is false
– a double called ‘price’ to hold the price of the room for a 1 night occupation. this
depends on the ‘sleeps’ attribute and is assigned as follows
o single rooms, sleeps = 1, price = 40
o double room, sleeps = 2, price = 75
o triple room, sleeps = 3, price = 105
o quad room, sleeps = 4, price = 130
create get functions for all attributes. create set function for ‘sleeps’ and ‘occupied’ only. the
price will be set in the ‘setSleeps’ accordingly. create the default argument constructor with
only the integer for the ‘sleeps’ and the boolean for the ‘occupied’.
Class level
Create a class called ‘level’ to describe a floor of a hotel. the class has the following
attributes:
– an integer called ‘number’ to signify the number of the floor (default value is 1 and
acceptable values are between 1 and 5)
– an array of 40 room objects (call it ‘rooms’). the first 20 will be single the next 10
will be double, the next 5 will be triple and the last 5 are quad.
create get and set functions for the attributes (see TIPS at the end of the description for
working with array data attributes). create a constructor with only the integer for the
‘number’ of the floor. The rooms array will be created and initialized manually inside the
constructor.
create a member function called ‘capacity’ which will consider room occupancies and return
how many people can sleep in the level (from the not occupied rooms of the level)
create a member function called ‘income’ which will consider room occupancies and return
an amount to be received as income (from the occupied rooms of the level)
Class hotel
Create a class called ‘hotel’ to describe a hotel. the class has the following attributes:
– a string called ‘name’ for the name of the hotel (default is “The CSC326 Grand”)
– an array of 5 level objects called ‘floors’ (each level using the respective floor
number 1 through 5).
create get and set functions for the attributes. create a constructor with only the string for
the ‘name’ of the hotel. the floors array will be created and initialized manually inside the
constructor.
create a member function called ‘capacity’ which will consider room occupancies and return
how many people can sleep in the hotel (from the not occupied rooms).
for example, if all singles of all floors were occupied then the capacity will be (5 floors
x 10 doubles) + (5 floors x 5 triples) + (5 floors x 5 quads) = 50×2+ 25×3 + 25×4 = 100 +
75 + 100 = 275.
the function must take an argument with a default value = 0. the argument signifies for
which level to get the capacity for. if value is 0, the function must calculate and return free
beds for the whole hotel (i.e. all levels), if value is anything from 1 till 5 then the capacity of
that specific level should be returned.
create a member function called ‘income’ which will consider room occupancies and return
an amount to be received as income (from the occupied rooms).
for example, if all singles of all floors were occupied then the income would be 5
floors x 20 single x 40 euro = 4000 euro
the function must take an argument with a default value = 0. the argument signifies for
which level to get the income for. if value is 0 the function must calculate and return income
for the whole hotel, if value is anything from 1 till 5 then the income of that specific level
should be returned.
Program driver
Write a driver program (I called mine driver.cpp) to create a hotel object and then write
code to go through each room of each floor of the hotel and set the occupancy. The setting
will be based on a random number generation. Use srand() (see TIPS) to seed using time and
then for every room generate a random number.
– If the number is odd and exactly divisible by 7, set occupied = true;
– Else, set occupied = false;
Write code to answer the following questions:
1. How many people can sleep in the hotel now? (after the randomization)
2. What is the income that the hotel will receive for tonight’s occupancies?
3. Show the capacity at each level and point out which of the hotel levels can
accommodate the most guests?
Repeat the code for randomization and generate a random number of each room but this
time:
– If the number if even and exactly divisible by 4, set occupied = true;
– Else set occupied to false;
Repeat the answer code to questions 1 through 3 above.
TIPS:
1. Whenever you are writing a get function that is supposed to return an array of class
Abc objects please note that you cannot return Abc[] getArray(). You must
instead return Abc* getArray() which is a pointer to an Abc object (i.e. the
first element of the array; which is how C++ interprets this)
2. Whenever you are writing set methods for an array be sure to include a for loop that
will go through elements and assign individually (and not as an array) if the
argument is arg and the attribute is called attr then you CANNOT write
something to assign the whole array, like attr = arg and be done with it; you
have to write a for loop to go through the array and have attr[i] = arg[i];
3. To generate time based random numbers you must:
a. #include
b. #include
c. And in the code, seed using: srand(time(0));
d. And generate random using: rand();
4. The capture below shows a sample compile & run on my machine

How to create Testimonial Carousel using Bootstrap5

Clients' Reviews about Our Services