Question: This program will take in data related to hotel room rates for one week and create a report for selected hotels. Write a complete C
This program will take in data related to hotel room rates for one week and create a report for selected hotels.
Write a complete C program that performs the following tasks:
Declare one 1-D array of char that can hold up to 20 characters.
Each element of this array corresponds to one hotel, indicating whether its data will be displayed or not.
Declare one 2-D array of double that can hold up to 20 rows and 7 columns.
Each row of this array corresponds to one hotel. Each hotel will have 7 values corresponding to their lowest room rate each night, Sunday night through Saturday night.
Ask for the number of hotels. You do not need error checking here; assume the input will be in the range from 1 to 20.
For the number of hotels, read in one character, and store it to the char array in order of entry. These characters will be 'y' or 'n'.
For the number of hotels, read in 7 double values and store them to the 2-D array by rows.
Finally, print the hotel report:
For each hotel
Check whether that hotel's prices should be printed (y/n from the char array).
If y, print that hotel's data with exactly one space between prices
If n, don't print anything (skip to the next hotel).
Notes: - Prices are to be printed with 2 decimal places. - Use the first line below as the prompt to start, and the second line as the label for each line of output in your program:
"How many hotels? " " Prices Sun - Sat: "
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
