Computer Science, asked by shashiangadi, 8 months ago

In the ticketing system of a Bank, each customer takes a ticket and is served when their number is called. Imagine there are five customers take a ticket from our ticketing system. The first customer has a ticket displaying the number 1 and the fifth customer has a ticket displaying the number 5. The customers who take the ticket should maintain a queue and the customer with the first ticket should be served first. When the first customer is served and that ticket is removed from the queue.

Implement this ticket system using appropriate data structure.

Note:

1. There is no limitation for the customers to take tickets.

2. Create a class called 'Ticket' to implement the main()

Sample Input Output 1: [Values given in bold represents the input]

Enter the number of customer takes the tickets:

3

The tickets in the system are:

1 2 3

Enter the number of tickets served:

2

The served tickets are:

1 2

The unserved tickets are:

3

Note: In the above sample the input provided by the user are 3, 2 which represents "number of customer takes the tickets" and "number of tickets served"

Sample Input Output 2:

Enter the number of customer takes the tickets:

5

The tickets in the system are:

1 2 3 4 5

Enter the number of tickets served:

5

The served tickets are:

1 2 3 4 5

No more tickets to be served


Sample Input Output 3:

Enter the number of customer takes the tickets:

-3

Invalid Number

Answers

Answered by nidaeamann
0

Answer:

Explanation:

void main void

{

int ticket

ticket = input("Enter the number of customer takes the tickets:")

printf("The tickets in the system are:")

for (int i=1; i<= tickets, i++)

     printf (i);

int served

served = inpu("Enter the number of tickets served:")

printf(The served tickets are:)

for (int j=1; j<= served, j++)

     printf (j);

printf("The unserved tickets are:")

for (int k=served+1; k<= tickets, k++)

     printf (k);

return

}

Similar questions