Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In c++ language. Your task is to create a program that computes the total cost of reserving one or more hotel rooms for specified number

In c++ language.

Your task is to create a program that computes the total cost of reserving one or more hotel rooms for specified number of days. An off-season room is $50.00 per night, and during the on-season it is $100.00 per night. When a group reserves 6 rooms or more they get a discount of 10% on the reservation cost. Some states have a sales tax which is a fraction of the discounted reservation cost. The total cost will be computed as the sum of the discounted reservation cost plus taxes. Note: it will count against you if you tax them on the reservation cost before any discounts are applied!

Program requirements:

Prompt for four inputs

Display a friendly message asking for the following information (and assume the input is valid):

  • season (0=off-season or 1=on-season)
  • number of rooms
  • days of stay
  • sales tax entered in without a '%' (for example, inputting 10 means a 10% sales tax).

Compute output variables

Compute these variables in the following order.

  • the reservation cost
  • the discounted reservation cost (make this a separate variable from the reservation cost!)
  • tax (which is a fraction of the discounted reservation cost)
  • total cost

Display output

There will be at most four lines of output: the reservation cost, the discounted reservation cost which is shown only when there is a discount, the tax, and the total cost.

Each line of output will consist of three sections, and each section will line up vertically:

Section 1: the first containing text, 50 character width, left-justified

Section 2. a '$' character

Section 3. An amount of money, showing a fixed decimal point with two places, 10 character width, right-justified

Test data:

  1. 0 2 1 0 (represents a two-room reservation during the off-season, one night, 1% tax)
  2. 1 2 1 1.0 (represents a two-room reservation during the on-season, one night, 1% tax)
  3. 0 10 10 0 (represents a ten-room reservation during the off-season, ten nights, 0% tax)
  4. 1 10 10 5.0 (sample output below, represents a ten-room reservation during the on-season, ten nights, 5.0% tax)

Reservation cost: $ 10000.00

Discounted reservation cost: $ 9000.00

Taxes: $ 450.00

Total cost: $ 9450.00

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

Advances In Databases And Information Systems 25th European Conference Adbis 2021 Tartu Estonia August 24 26 2021 Proceedings Lncs 12843

Authors: Ladjel Bellatreche ,Marlon Dumas ,Panagiotis Karras ,Raimundas Matulevicius

1st Edition

3030824713, 978-3030824716

More Books

Students also viewed these Databases questions

Question

What are the main objectives of Inventory ?

Answered: 1 week ago

Question

Explain the various inventory management techniques in detail.

Answered: 1 week ago