Flow Control 3b

Description

The purpose of this challenge is to use conditional constructs (IF-ELSE, IF-ELSE-IF, nested IF statements). This challenge simulates a hotel reservation system.

Requirements

  1. Ask the user to enter their first name. Don’t forget to first declare a variable for the first name.
  2. Ask the user to enter their last name. Don’t forget to first declare a variable for the last name.
  3. Ask the user to enter their age. Don’t forget to first declare a variable for the age.
  4. If the user is younger than 18 yrs old, display a message indicating that they cannot make a hotel reservation. Otherwise, continue and ask the user more questions (see below)
  5. Ask the user what kind of bed is preferred (king size, queen size, twin). You must use an if-else-if construct to display a friendly message about the selected bed type.  (Hint: Use a char variable)
  6. Ask the user how many nights the reservation will include
  7. Ask the user what room type is preferred (beach view, city view, balcony, garden view. In this hotel, all room reservations typically cost $100/night. However, Beach View rooms cost $25 more. You can use any IF construct here (IF, IF-ELSE, IF-ELSE-IF, nested IFs).
  8. Additionally, rooms with king size beds cost $10 more. This cost is added to the room cost regardless of room type.
  9. Display a message indicating the cost of the reservation. A 5% city tax is also added to the cost.

DO NOT USE

You may not use any looping mechanisms or user-defined functions.

Sample Interaction / Output

It's a lovely day at the Challenge Hotel!
Please enter your first name to begin your reservation: Will
And your last name: Power

Thank you, Will Power, how old are you? 15
Sorry, you must be at least 18 years old to make a reservation.

RUN IT AGAIN:

It's a lovely day at the Challenge Hotel!
Please enter your first name to begin your reservation: Anita
And your last name: Roome

Thank you, Anita Roome, how old are you? 37

Great! We have rooms with different types of beds
You can choose from (K - King, Q - Queen, T - Twin)
What's your preference? K
Awesome! Our king size beds are amazing!

How many nights will you be staying? 2

Last question, what kind of room would you like, we have:
  B - Beach View
  C - City View
  Y - Balcony
  G - Garden View
What's your preference? B

Anita, your room is reserved for 2 nights. Your Beach View room with a king size bed will be ready. Please pay $283.50.

In the sample interaction above, the final bill is calculated as $100 + $25 + $10 per room (surcharges for Beach View and King Size bed), for 2 nights, plus tax. Make sure you test your code with various combinations of rooms and beds.

Hints

  1. It’s good practice to initialize variables to default values that make sense
  2. Include the <iomanip> header file. This will allow you to use various options to format your output such as setprecision
  3. Include the code below before any other cout lines. The setprecision(x) will display your decimal output with x decimal places.
cout << fixed << setprecision(2);

LEGEND
PROGRAM OUTPUT
USER ENTRY
FROM INPUT

CATALOG ID: CPP-FLOW0003b

Print Requirements