Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Practice using arrays Practice using symbolic constants Practice using enums (optional - BONUS) Develop a simple menu system. Practice using functions and passing arrays to

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Practice using arrays Practice using symbolic constants Practice using enums (optional - BONUS) Develop a simple menu system. Practice using functions and passing arrays to functions. Description Your client from HW1 (Interpedia) was impressed with your solution, so they are giving you a larger project. This time, they want you to build a hotel booking system - the Mizzou Accommodations Reservation System (MARS). You will do this by implementing the user- defined functions as explained below. Your program must print a menu for the user to select what he/she needs to do with the application. The application only displays hotel brands, room types, and prices in various ways. Note that it does not actually allow the user to select a hotel/room combination to book a room. Global constants and variables /1 Symbolic constants #define COUNTHOTELS 6 #define COUNTROOMTYPES 5 #define STRINGMAX 64 // Globals const char const hotelNames [COUNTHOTELS] [STRINGMAX] -f"Marriott", "Hilton", "Best Western", "Holiday Inn", "Motel 6", "Super 8"; const char const roomNames[COUNTROOMTYPES][STRINGMAX] {"Standard King", "Standard Two Queens", "Suite Two Queens", "Suite King", "Suite Presidential"]; int costMatrix[COUNTHOTELS][COUNTROOMTYPES]- 1200,200,350,375,550}, // Marriott 180,210,325,350,600}, // Hilton 1125,125, 240,250,400}, // Best Western (130,135,250,275,450}, // Holiday Inn 1119,119,239,249,399}, // Motel 6 (118,118,240,247,3891, I/ Super 8 b: Functions to implement 1. const char * const GetHotelName(int hotel) Returns the string from the hotelNames global variable that corresponds to the given hotel number. 2. const char * const GetRoomName (int room) Returns the string from the roomNames global variable that corresponds to the given room number. 3. void PrintHotel0ptions () Prints the list of hotels. Note that the numbering of this list is 1-based. If you do the bonus, the HOTEL enum is 0-based. 4. void PrintRoomoptions() Prints the list of room types. Note that the numbering of this list is 1-based. If you do the bonus, the ROOM enum is O-based. 5. void PrintHotelRoomsLessThan(int Prints the list of hotel/room pairs and their prices iLimit) 6. int getMainMenuChoice() 7. int GetRoomPrice(int hotel, int room) Returns the price of a given room in a given hotel. 8. void PrintHotelRoomsByHotel(int hotel) Prints the list of all room prices for a given hotel. 9. void PrintHotelsByRoom(enum ROOM room) Prints the list of all hotels and prices for a given room type. int main(void) 10. Yep, you are gonna need a main. The main should prompt the user for a choice from the main For choice 1, it should show them the hotel choices and allow them to select one. After selecting a hotel, the user should see the room prices for that hotel. selecting a room, the user should see the room prices for that room across all hotels. For choice 3, the user should be prompted for a price limit. After entering this limit, the For choice 4, the program should exit. After any choice except #4, the program should again display the menu and continue on. Anything entered by the user should be error-checked to be sure it is in the correct range. If not, an error message should be printed, and the program should continue. **Main Menu 1. Display by hotel 2. Display by room type 3. Display by price limit 4. Exit program Please make a selection: 0 **Error: Please select a choice 1 4 **Main Menu 1. Display by hotel 2. Display by room type 3. Display by price limit 4. Exit program Please make a selection: 5 **Error: Please select a choice 1 4 **Main Menu 1. Display by hotel 2. Display by room type 3. Display by price limit 4. Exit program Please make a selection: 1 1. Marriott 2. Hiltorn 3. Best Western 4. Holiday Inn 5. Motel 6 6. Super 8 Select a hotel: 0 *Error: choice out of range Please make a selection: 1 1. Marriott 2. Hilton 3. Best Western 4. Holiday Inn 5. Motel 6 6. Super 8 Select a hotel: 3 Rooms at Best Western: Best Western Standard King ($125) Best Western Standard Two Queens ($125) Best Western Suite Two Queens ($248) Best Western Suite King ($250) Best Western Suite Presidential ($400) **Main Menu 1. Display by hotel 2. Display by room type 3. Display by price limit 4. Exit program Please make a selection: 2 1. Standard King 2. Standard Two Queens 3. Suite Two Queens 4. Suite King 5. Suite Presidential Select a room: 6 *Error: choice out of range **Main Menu 1. Display by hotel 2. Display by room type 3. Display by price limit 4. Exit program Please make a selection: 2 1. Standard King 2. Standard Two Queens 3. Suite Two Queens 4. Suite King 5. Suite Presidential Select a room: 5 ***Hotels with room Suite Presidential: Marriott Suite Presidential ($550) Hilton Suite Presidential ($680) Best Western Suite Presidential ($400) Holiday Inn Suite Presidential ($458) Motel 6-Suite Presidential ($399) Super 8 - Suite Presidential ($389) **Main Menu 1. Display by hotel 2. Display by room type 3. Display by price limit 4. Exit program Please make a selection: 3 Enter the maximum price in dollars you will pay: 120 Rooms less than $120: Motel 6-Standard King ($119) Motel 6 Standard Two Queens ($119) Super 8 Standard King ($118) Super 8- Standard Two Queens ($118) **Main Menu 1. Display by hotel 2. Display by room type 3. Display by price limit 4. Exit program Please make a selection: 4 Thank you for using MARS!*

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

When do you use beginning balances verses ending balances?

Answered: 1 week ago

Question

f. Did they change their names? For what reasons?

Answered: 1 week ago