Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 1: (50 points) The name of the C++file must be hotel.cpp Write a program that calculates the total charges for a guest's hotel stay
Problem 1: (50 points) The name of the C++file must be hotel.cpp 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 "n") 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 0. 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 Note: Validate your inputs using loops, example Number of nights: 0 The number of nights must be greater than zero. Please re-enter: 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started