Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description (It Has to work with C++ Thank you) The purpose of this challenge is to use conditional constructs (IF-ELSE-IF and SWITCH statements. This challenge

Description (It Has to work with C++ Thank you)

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

Requirements

Ask the user to enter their first name

Ask the user to enter their last name

Ask the user to enter their age.

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)

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)

Ask the user how many nights the reservation will include

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 must use a switch statement to implement the cost calculation based on the room type selection.

Additionally, rooms with king size beds cost $10 more. This cost is added to the room cost regardless of room type.

Display a message indicating the cost of the reservation. A 5% city tax is 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

Its good practice to initialize variables to default values that make sense (for example, set cost to 0.00)

Include the header file. This will allow you to use various options to format your output such as setprecision

Include the code below before any other cout lines. The setprecision(x) will display your decimal output with x decimal places.

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

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

Students also viewed these Databases questions

Question

Compute an expression for P max t1st2 B(s) > x

Answered: 1 week ago

Question

love of humour, often as a device to lighten the occasion;

Answered: 1 week ago

Question

orderliness, patience and seeing a task through;

Answered: 1 week ago

Question

well defined status and roles (class distinctions);

Answered: 1 week ago