how do i solve this assignment

create a reservation system for a restaurant. The restaurant has 20 tables. Here is the functionality required for this system (you may want to display a menu and let user choose options 1 to 4, make sure to put your program in a loop so program does not exit until user chooses menu 4):

1- Reserve a Table
User needs to input the table number (Tables are numbered from 0 to 19). If the table is not available (reserved), inform the user that the selected table is not available. If the table is available, then ask for the name (name is a single word, no space) and mark the table as reserved.

2- Clear Reservation
User needs to input the table number (Tables are numbered from 0 to 19). If the table is not reserved, inform the user that the selected table is already available (nothing to clear). If the table is reserved, mark it as available. That table is no longer reserved.

3- Report
Prints out the state of each table. Each table is printed on a separate line -- so your report will print out 20 rows. If reserved, it will print out the name on the reservation next to the table number. If available, it should print out "available".

4- Exit Program.

You can keep everything in the main function. I would recommend keeping a two arrays (parallel arrays!), both are size 20, one of type boolean (reserved or not) and the other one of type string (name on reservation if reserved).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>

using namespace std;

double tablesReserved(double c, double p);

// this is the main function
int main()
{
	int availability[20];
	double tableNumber[20];
	
	for(int i = 0; i < 20; i++)
	{
		cout << "the table number " << (i + 1) << " ";
		cin >> tableNumber[i];
		cout << "the availability status?";
		cin >> availability[i];
	}


	
	system("PAUSE");
	return 0;
}

Last edited on
you want us to do your homework?
i need an answer

What is the question? I see no question in your post.
Topic archived. No new replies allowed.