Question: Question: In this lab exam, you are required to write a C program that does hotel price calculation for any number of guests by calling

 Question: In this lab exam, you are required to write a
C program that does hotel price calculation for any number of guests

Question: In this lab exam, you are required to write a C program that does hotel price calculation for any number of guests by calling for each guest a find_hotel_price function that you will define. Your function find_hotel_price should receive the type of the room and the duration of the stay in days as input parameters from the main function and calculate and return the price to the calling main function. The hotel offers only single room (denoted by character value 's') or double type rooms to the their guest (denoted by character value 'd'). Define a function named find_hotel_price. The find_hotel_price function should receive the type of the room and the duration of the stay in days from the main function. The find_hotel_price function should calculate the price and return the price to the main function. The accommodation charge of a room is as follows: The price of single room for one night stay is 250$ and double room is 4005 If a guest chooses a single room and if the guest prefers to stay for more than 2 days, the hotel charges 225$ for each additional day (starting with the third day). If a guest prefers to stay in a double room for more than 3 days, the hotel charges 2508 for each additional day (starting with the fourth day). The main function inputs from the user for each guest the type of the room and the duration of the stay in days as shown in the sample run, calls find_hotel_price function to take the price and displays the price as shown in the sample run. Your program will terminate when 'n' is entered, and loop for another guest if y' is entered. Sample Run: which type of room do you want to stay? s How many days? 2 The total price is : 588$ Do you want to continue (y) : y which type of room do you want to stay? d How many days? 3 The total price is : 1200$ Do you want to continue (y) : y which type of room do you want to stay? s How many days? 4 The total price is : 950$ Do you want to continue (y): Y Which type of room do you want to stay? d How many days? 5 The total price is : 1700$ Do you want to continue (y) in Process exited after 41.06 seconds with return value Press any key to continue

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!