C
CK
Good Morning All,
I am writing an app to calculate the cost of a hotel room. I am new to c++.
I have decided to try using the Strategy Design Pattern. I want a superclass
HotelRoom, and then make 3 classes that inherit from it. SuiteRoom,
StandardRoom, and DeluxeRoom. The price of the room is based on 3 factors,
if there is are more then 2 people in the room, there is a $10 charge per
persons over 2, if they add an extra bed, and the room type. I was thinking
of making a RoomType interface with a price() method, then making 3 classes
that implement the interface, SuitePrice, StandardPrice, and DeluxePrice. I
do not know how to code interfaces in c++. Does anyone have any samples to
get me going? Ultimately this will be a console app. I want to ask the user
how many rooms they would like and for how many days? Then make an array of
HotelRooms with the number of elements (rooms) the user indicated. I would
then loop through and ask how many people in each room, and if they wanted
an extra bed in the room. The ultimate goal would be to display the total
price for all rooms to the user. Any advice?
TIA,
~ck
I am writing an app to calculate the cost of a hotel room. I am new to c++.
I have decided to try using the Strategy Design Pattern. I want a superclass
HotelRoom, and then make 3 classes that inherit from it. SuiteRoom,
StandardRoom, and DeluxeRoom. The price of the room is based on 3 factors,
if there is are more then 2 people in the room, there is a $10 charge per
persons over 2, if they add an extra bed, and the room type. I was thinking
of making a RoomType interface with a price() method, then making 3 classes
that implement the interface, SuitePrice, StandardPrice, and DeluxePrice. I
do not know how to code interfaces in c++. Does anyone have any samples to
get me going? Ultimately this will be a console app. I want to ask the user
how many rooms they would like and for how many days? Then make an array of
HotelRooms with the number of elements (rooms) the user indicated. I would
then loop through and ask how many people in each room, and if they wanted
an extra bed in the room. The ultimate goal would be to display the total
price for all rooms to the user. Any advice?
TIA,
~ck