Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!