Program that calculates the total charges for a guest’s hotel stay and outputs it to a text file

25.00 $

Categories: ,

Description

5/5 - (1 vote)
Write a program that calculates the total charges for a guest’s hotel stay and outputs it to a text file.

The program will ask if the guest is a Club member or not.

If the guest is a Club member, the following data should be entered:

The number of nights spent in the hotel

Room type

The type of Club membership:

If Gold Club member, apply a %15 discount

If Bronze Club member, apply a %10 discount

If Silver Club member, apply a % 5 discount

If the guest is not a member, the following data should be entered:

The number of nights spent in the hotel

Room type

If breakfast Buffet was included (+$10 per night)

Room types:

Economy Room ($70 per night)

Standard Room ($100 per night)

Luxury Room ($150 per night)

Coding Requirements

The program must use a function that gets the guest type (member “m” or non-member as a char and returns this type to main function to proceed accordingly. The program must also use two functions to calculate the total charges. One of the functions should accept arguments for the Club member data, while the other function accepts arguments for non-members. Both functions should return the total charges. The function for Club members should use another function that calculates the discount before returning it to main function. main function will then write received charges to the file “Hotellnvoice.txt” (charges in txt file must be rounded to two decimal places).

The function that gets the Hotel type should consider ‘m’ and ‘M’ as valid user inputs for the guest type “member”. Same for non-members; ‘n’ and ‘N’ are valid inputs.

Input Validation: The number of nights spent in the hotel must be greater than O. Other than that, do not accept negative numbers for any other data (use a loop for input validation).

Make sure you design the program outline before writing your code.

  • Hotel.zip