Question: Develop C program You are required to develop a program to record an information about passenger for a bus trip from Kuantan to these 3

Develop C program

Develop C program You are required to develop a program to record

You are required to develop a program to record an information about passenger for a bus trip from Kuantan to these 3 destinations: Putrajaya, Kota Bahru and Ipoh. This record for each passenger contains the following data items: seat no, name, telephone no, gender, destination and ticket price. The ticket price for Putrajaya, Kota Bahru and Ipoh is RM 28.60, RM 34.60, and RM 44.00, respectively. From Figure 1, the passenger will buy a ticket at the bus counter. BUS TICKET Figure I Bus Ticket Counter Below is a sample of input for the program as shown in Table 1. Table 1 Sample input No Name Destination Gender 1 2 3 Zarul Ahmad Siti Aishah Mohd Adam John Lee Shahrul Ali Shanti Chan Lee Abdul Kadir Putrajaya Kota Bahru Ipoh Putrajaya Ipoh Putrajaya Kota Bahru Ipoh 4 Tel No Ticket Price 0129856451 28.60 0119856525 34.60 0116854123 44.00 0135256341 28.60 0146668585 44.00 0171112854 28.60 0145614747 34.60 01232321454 44.00 Male Female Male Male Male Female Male Male Seat No 2 5 4 1 3 3 10 9 6 7 8 Create a program to record the passenger information using array. The program will insert the passenger into the queue after buying a ticket. There are three menus as shown in Figure 2. The first menu is Buy Ticket'. Menu Buy ticket is used to insert passenger information when they buy a ticket. This menu will call read_passenger_info function. The read_passenger_info function is used to record the information of passenger based on Table 1. The ticket price is determined based on destination. The passenger will get ticket confirmation after they buy a ticket as shown in Figure 3. Second menu is 'List of Passenger'. This menu will show all list of passenger on the day as shown in Figure 3. Third menu is "Statistic Passenger?. This menu will show the statistic of number of passenger for each destination, total sales for each destination and number of male and female at the end of the day. This menu will display statistic using dequeue as shown in Figure 3. int main() { int ch; int TRUE=1, FALSE=0; int choice=TRUE; while (choice==TRUE) { printf(" -- -BUS XYZ- printf(" 1 Buy Ticket"); printf(" 2 List of Passenger"); printf(" 3 Statistic Bus XYZ"); printf(" 4 Exit "); printf(" Enter choice: "); scanf("%d",&ch); switch (ch) 1 case 1: buy ();break; case 2:list();break; case 3: statistic();break; case 4: choice=FALSE; break; default: printf(" only one of the above"); return 0; 1 Figure 2 Main Program --TICKET BUS SYSTEM--- 1 Buy Ticket 2 List of Passenger 3 Statistic bus XYZ 4 Exit Enter menu :1 Menu Buy Ticket Enter a name: Mohd Adam Enter seat no: 4 Enter gender : M Enter tel no. : 0116854123 Enter destination : Ipoh Order Confirmation- Name of Passenger: Mohd Adam Seat No: 4 Gender: M Tel no. : 0116854123 Destination : Ipoh Ticket Price : RM 44.00 ---TICKET BUS SYSTEM- 1 Buy Ticket 2 List of Passenger 3 Statistic bus XYZ 4 Exit Enter menu 2 Menu List of Passenger Name Seat No Destination Zarul Ahmad Siti Aishah Mohd Adam Putrajaya Kota Bahru Ipoh ---TICKET BUS SYSTEM--- 1 Buy Ticket 2 List of Passenger 3 Statistic bus XYZ 4 Exit Enter menu: Menu Statistic Passenger Destination Number of Passenger Total Sales Putrajaya Kota Bahru Ipoh 28.60 34.60 44.00 Gender Number of Passenger M F Figure 3 Sample Output

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!