Question
Java This project is dealing with theater seating. Write a program in Java to fill a theater with seat reservations in an optimal order. You
Java
This project is dealing with theater seating. Write a program in Java to fill a theater with seat
reservations in an optimal order.
You will decide
what the optimal order is, and you will
design an algorithm to implement it.
3.
Assume that a theater has 16 rows of seats, and unrealistically, that every row has 11 seats,
for a total of 176 seats. Requests for seating will be generated by a random-number generator
(using the system time as the seed), and the requests will be for a minimum of 1 seat, and a
maximum of 5 seats.
4.
Your program will satisfy the requests by computing the best available seats at the time of
the request, from the point of view of the patron, not the theater. Seat requests
can not
be
split; they must fill consecutive seats in a single row. Satisfying the request will consist of
filling the specified seats with the number of the request, itself, always with 3 digits (e.g.
001, 002, 003,
etc.). An unfilled seat will be represented by three periods (i.e.
...
).
5.
When displaying the theater, you must display the row number and the seat number as labels
on the two edges of the theater (see below). The first row printed is the first row of the
theater.
For example, for a theater with only 5 rows and 4 seats per row, heres the empty theater:
1 2 3 4
1 ... ... ... ...
2 ... ... ... ...
3 ... ... ... ...
4 ... ... ... ...
5 ... ... ... ...
Assume that request 1 is for 2 seats, and assume that I think the second row middle is the
best. Then heres how the theater looks like after fulfilling request 1:
1 2 3 4
1 ... ... ... ...
2 ... 001 001 ...
3 ... ... ... ...
4 ... ... ... ...
5 ... ... ... ...
Assume that request 2 is for 1 seat, and assume that I think being closer is better than being
farther to the side. Then heres how the theater looks like after fulfilling request 2:
COSC602
Bonus Project 1
2
1 2 3 4
1 ... 002 ... ...
2 ... 001 001 ...
3 ... ... ... ...
4 ... ... ... ...
5 ... ... ... ...
This process is to continue until either the theater is full, or 10 consecutive requests have
been unable to be filled.
6.
It is up to you to define what constitutes the best set of seats at any given time. That makes
no single answer the right one. There are many right answers, but certainly not all answers
are right. Just using common sense, the final seating arrangement should seem reasonable to
you, and hopefully to the instructor also! Be sure to document your algorithm, and your
heuristic for deciding what constitutes the best seats.
7.
Even though your print-out is a 16x11 theater, it is very important that you do
not
solve the
problem with only the 16x11 theater in mind. Your program should be able to generate
solutions for different size theaters by just changing a couple of constants and recompiling.
This includes tiny theaters, say 1 seat!
8.
In addition to outputting the final seating arrangement, your program must also output the
following statistics:
a.
number of seats in the theater
b.
number of seats filled
c.
number of seats unfilled
d.
number of requests
e.
number of requests satisfied
f.
number of requests denied
g.
termination condition (theater full or 10 consecutive requests denied).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started