1 Perform a program of an arrangement of 20 positions Each p

1. Perform a program of an arrangement of 20 positions. Each position will represent the seat of a bus. By means of a menu can be made:

to. Tickets sale

B. Inquiries

C. Report

D. Get out



Ticket sales will ask what seat you want if it is empty it will become busy. (0-empty, 1 Busy).

Inquiries will ask for the seat number and indicate if it is occupied or empty.

In Report will be all the seats and their status (Busy / Empty).

Note: After each operation a, b or c, the program must return to the main menu until the option exits.
1. Perform a program of an arrangement of 20 positions. Each position will represent the seat of a bus. By means of a menu can be made:

to. Tickets sale

B. Inquiries

C. Report

D. Get out



Ticket sales will ask what seat you want if it is empty it will become busy. (0-empty, 1 Busy).

Inquiries will ask for the seat number and indicate if it is occupied or empty.

In Report will be all the seats and their status (Busy / Empty).

Note: After each operation a, b or c, the program must return to the main menu until the option exits.
1. Perform a program of an arrangement of 20 positions. Each position will represent the seat of a bus. By means of a menu can be made:

to. Tickets sale

B. Inquiries

C. Report

D. Get out



Ticket sales will ask what seat you want if it is empty it will become busy. (0-empty, 1 Busy).

Inquiries will ask for the seat number and indicate if it is occupied or empty.

In Report will be all the seats and their status (Busy / Empty).

Note: After each operation a, b or c, the program must return to the main menu until the option exits.

Solution

I have did it in C++

#include <iostream>
#define BUSY 1
#define EMPTY 0
/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */
using namespace std;

int main(int argc, char** argv) {
   int arr[20],ticket;
  
   char ch;
   cout << \"\\t\\tWELCOME TO THE BUS TICKET INFORMATION SYSTEM\ \";
   for(int i=0;i<20;i++)
       arr[i] = 0;
   do{
       cout << \"\ A.Ticket Sale()\ B.Inquires()\ C.Report()\ D.get Out[\'s\' for exit]\ Choose your option:\\t\";
       cin >> ch;
       switch(ch){
           case \'A\':
               cout << \"\ Enter the seat you want:\\t\";
               cin >> ticket;
               if(ticket >0 && ticket <=20){
                   for(int i=0;i<20;i++){
                       if(arr[ticket]==EMPTY){
                           arr[ticket] = BUSY;
                          
                       }
                   }
               }
               break;
           case \'B\':cout << \"\ Enter seat number:\\t\";
                   cin >> ticket;
                   if(arr[ticket] == BUSY)
                       cout << \"\\t\" <<ticket << \" is OCCUPIED:\ \";
                   else
                       cout << \"\\t\" << ticket << \" is NOT OCCUPIED:\ \";
                  
                   break;
           case \'C\':
               for(int i=0;i<20;i++){
                   if(arr[i] == BUSY)
                       cout << \"\\t\" << i << \" >>> BUSY\ \";
                   else
                       cout << \"\\t\" <<i << \" >>> EMPTY\ \";
                      
               }
               break;
           case \'D\' : exit(0);
           default : cout << \"Wrong Input\ \";
       }
   }while(true);
   return 0;
}

 1. Perform a program of an arrangement of 20 positions. Each position will represent the seat of a bus. By means of a menu can be made: to. Tickets sale B. Inq
 1. Perform a program of an arrangement of 20 positions. Each position will represent the seat of a bus. By means of a menu can be made: to. Tickets sale B. Inq

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site