Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSE 412- Project #5 Write a program in C++ which will reserve seats for a concert. There are 5 rows of 8 seats, a random

CSE 412- Project #5

Write a program in C++ which will reserve seats for a concert. There are 5 rows of 8 seats, a random access file must be used to keep track of which seats have been reserved. Each seat will have one byte reserved to indicate whether it is taken or not. The seat s in row r is recorded in byte (8*r+s-1) of the file to indicate that the seat is occupied (record an "O") You may create the random access file prior to running the programs, it simply needs to have zero length. Every request will be followed by a conrimatory response, and the date and time should also be recorded. The protections of the data file (concert.dat) are: $touch concert.dat and $chmod uh+lrw concert.dat

Your program should prompt for a function $ Reserve or Display . D results in the display of occupied seats while R prompts for the row number and then a range of sat numbers. Entering Q quits the program. All file entries should be in raw I/O format (using buffers) with error control and boundary checking.

Run 1:

Reserve seats 2-5 in row 1

Reserve seats 4-7 in row 2

Attempt to reserve seat 4 in row 2 - rejected

Reserve seat 3 in row 1

Display reserved seats:

1 2 3 4 5 6 7 8

X O O O O O O O

X X X O O O X X

X X X X X X X X

X X X X X X X X

X X X X X X X X

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions