Topic: Java 1000 help
Part A: Airline seating
Millions of commercial airline flights cross the world's cities every year, and each one of these
flights must solve what seems like a simple problem: how do you arrange where each passenger
on one of those flights sits? In this assignment, we will solve a variation on that problem, where
we will observe one restriction on the seats: people who book a flight together will be — if
possible — seated together.
Your program will process data from an array of strings (call this the "bookings" array). The first
array element will contain a number indicating how many seats the aircraft has. The remaining
elements will contain information about groups of passengers who have booked seats on the
flight. The first element of this grouping will be a number that indicates how many people are in
the group. The remaining elements identify the individual passengers in that group by their last
and first name. For example, the array might contain the following 10 strings:
which means there are 8 seats on the flight, the first group of passengers has 2 people (with their
names below), the second group has 1 person, and the third group has 3 people.
Normally this data would come from input, such as lines from a text file, not from an array.
That's the next assignment.
The seating chart for the flight will be stored in an array of strings (call this the "seats" array),
whose size is equal to the number of seats on the flight. Each position in the array corresponds to
a seat on the flight; the first element in the array is seat 1, the second element is seat 2, etc.
Initially all the seats are empty. Passengers will be seated by placing their name in this array.