In this lab you will implement tickets-for-seat-management system. The basic idea is that your program reads an event number and seat number request from a user, and determines if the seat is available (and marks it taken if it was), or is unavailable (so asking the user to choose again). As part of that exercise, you’ll be working with a file of “canned” requests to exercise your program. That is, instead of typing the requests in to your program, the program will read ‘typed in’ requests from a file.
Fortunately for you, linux (also MacOS) provides a trivial way for you to do this without making any changes to your program. Your programs have been reading using cin and writing using cout. linux understands these as, in its terminology, stdin and stdout respectively. Normally, stdin is ‘mapped’ to your keyboard, so what you type shows up as coming from stdin, hence available to your program with cin. Similarly, stdout is mapped to the window where you see output.
You can change this mapping: you can redirect stdin to be any file you have on your computer. So, if you run your interactive program by typing:
a.out
then you can run your program and have it read from a file using:
a.out < my_infile
where the input that would have been typed in on the keyboard is
already in your file my_infile.
You can do the same thing for redirecting stdout: you can cause output that would normally appear on your screen to go, instead, to a file:
a.out > my_outfile creates, or rewrites, my_outfile
a.out >> my_outfile creates, or appends to existing
my_outfile.
And, of course, you can redirect both input and output:
a.out < my_infile > my_outfile
2. Booking Seats
The program you write handles availability of seats in a 250-seat auditorium for an event taking place on five consecutive days (1st, 2nd, 3rd, 4th,and 5th of the month). You need to use a two-dimensional array to model the seats: one dimension is the date, the other is the seat number.
Before ticket sales begin, you have to mark all the seats for all days as available.
Then you go into a loop asking a user for the day number (1..5) and seat number they want, check if the seat is available, and either mark it taken now (and confirm to the user they have the seat), or, tell them it’s unavailable and they should choose again. Each line of input to your program contains two numbers separated by exactly one space: you can re-use some of the code you wrote for lab 6 where you read input lines using getline() and separated two variables from the string you read in.
Note that customers expect seat numbers to range 1..250 but since your array uses 0..249 you’ll need to ‘adjust’ the seat number selected by the user. Analogously users will expect day numbers to range 1..5 which you’ll need to adjust to 0..4 for your array.
When you prompt the user, the program must provide the range of date numbers and seat numbers from which to choose, and check that the user provided valid input in each case.
Test your program on some data you type in to ensure that it correctly handles:
getting a seat that’s available,
not getting a seat if it’s already taken,
bogus date and/or seat numbers from the user. You should also test your program on the test data
file available on-line.
#include<iostream>
using namespace std;
bool seats_available[5][250];
void bookSeat(bool seats_available[5][250]);
int main(){
int i=0,j=0;
for(i=0;i<5;i++){
for(j=0;j<250;j++){
seats_available[i][j]=true;
}
}
bookSeat(seats_available);
// bookSeat(seats_available);
}
void bookSeat(bool seats_available[5][250]){
repeat:
int r,c;
cout<<"Choose the event day from 1-5 ";
cin>>r;
while(r>5||r<1){
cout<<"Choose the event day from 1-5 ";
cin>>r;
}
cout<<endl<<"Choose seat number from 1-250 ";
cin>>c;
while(c<1||c>250){
cout<<endl<<"Choose seat number from 1-250 ";
cin>>c;
}
if(seats_available[r-1][c-1]==true)
{
seats_available[r-1][c-1]=false;
cout<<"Your booking is complete"<<endl;
}
else{
cout<<"Sorry, this seat is not available. Please choose
another seat"<<endl;
goto repeat;
}
}

In this lab you will implement tickets-for-seat-management system. The basic idea is that your program reads...
Using C not C++, Write a program that can be used by a small theater to sell tickets for performances. The theater’s auditorium has 15 rows of seats, with 30 seats in each row. The program should display a screen that shows which seats are available and which are taken. For example, the following screen shows a chart depicting each seat in the theater. Seats that are taken are represented by an * symbol, and seats that are available are...
Labs CSIT 210 Introduction to Programming LAB 9B Arrays Change the program AirlineDriver.java to assign passenger seats in an airplane. Chesapeake Airlines is a small commuter airline with seats for 20 passengers in 5 rows of 4 seats each. Here is the layout: 1ABCD 2ABCD 3ABCD 4ABCD 5ABCD The user enters the row (1 – 5) and the seat (A – D). The seat entry may be lowercase. Use this code to enter the seat: System.out.print(" Enter row and seat...
C++ Help please- kind of long. The aim is to implement a seat reservation system for a passenger airplane. We assume a small airplane with 10 rows and 4 seats per row. We assume that the seat chart is initially stored in a file “chartIn.txt” in the following format: 1 A B C D 2 A B C D 3 A B C D 4 A B C D 5 A B C D 6 A B C D 7 ...
Write pseudocode for a program where the seating map for a particular performance at a theater contains 70 rows of 100 seats each. Using an array where applicable, develop the pseudeocode for a program that allows a user to continuously enter each household size and then a) Allows a user to continuously enter a row number and seat number until they enter an appropriate sentinel value for the row number in order to stop entering input. Each time the user...
Can you help us!! Thank you!
C++
Write a program that can be used by a small theater to sell tickets for performances. The program should display a screen that shows which seats are available and which are taken. Here is a list of tasks this program must perform • The theater's auditorium has 15 rows, with 30 seats in each row. A two dimensional array can be used to represent the seats. The seats array can be initialized with...
P7.5– A theater seating chart is implemented as a two-dimensional array of ticket prices, like this: 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 20 20 20 20 20 20 10 10 10 10 20 20 20 20 20 20 10 10 10 10 20 20 20 20 20 20 10 10 20 20 30 30...
MAKE SURE YOU TEST THE PROGRAM FISRT. DON'T PUT THE CODE WITHOUT TESTING. MAKE SURE ALL THE STEPS ARE FOLLOWED IN CORRECT MANNER ONLY USE VISUAL STUDIO C# CONSOLE APPLICATION Use File IO (NO JAVA CODING) Create a C# Console program that will demonstrate the use of File IO, Arrays, and Classes. This assignment has a number of requirements. Carefully read the document and note all the requirements. Also keep in mind that many of the requirements for this assignment...
A bus has 28 seats, arranged in 7 rows and 4 columns: This seating arrangement is mapped, row-wise, to a 1D-array of size 28: 0 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 27 Implement a well-structured C program to enable a user to make and cancel seat reservations for the bus. The program uses a text-file seats.txt to store the reservation...
Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a function that prompts the user for the name of a file to output as a text file that will hold a two dimensional array of the long double data type. Have the user specify the number of rows and the number of columns for the two dimensional array. Have the user enter the values for each row and column element in...
Write a C++ program to find the kth largest number among N numbers. You may assume 0 < k <= N. The numbers are in an input file. Input value of k from the user. Read the first k numbers into an array and sort them into non-increasing order. Next, read the remaining numbers one by one (until end-of-file). As a new number is read, if it is smaller than the number in position k-1 in the array, it is...