Question: public class Exercise 0 2 _ BoardingGate { / * Local Jetways is a regional airline operating at local airports. They use a basic passenger
public class ExerciseBoardingGate
Local Jetways is a regional airline operating at local airports.
They use a basic passenger manifest to represent seat occupancy on their plane.
Each passenger seat is represented as an element in a boolean array.
A value of AVAILABLE true indicates that seat is currently available.
A value of OCCUPIED false indicates the seat is not available.
private final boolean AVAILABLE true;
private final boolean OCCUPIED false;
A nearby airport has an incoming flight from Local Jetways. As the passengers disembark, the gate
attendant's first responsibility is to generate a new seating chart with each seat initially available.
Implement the logic to generate a seating chart using the required number of seats. Make sure to indicate
that each seat is initially AVAILABLE true
Note: The number of seats is guaranteed not to be negative.
Examples:
generateSeatingChartAVAILABLE AVAILABLE, AVAILABLE, AVAILABLE, AVAILABLE, AVAILABLE, AVAILABLE
generateSeatingChartAVAILABLE AVAILABLE, AVAILABLE, AVAILABLE, AVAILABLE
generateSeatingChartAVAILABLE AVAILABLE
public boolean generateSeatingChartint numberOfSeats
return new boolean;
Once passengers begin boarding the plane, gate attendants need a way to determine how many available
seats there are on the plane.
Using the array provided, implement the logic to count the number of available seats in the seating chart.
Examples:
getAvailableSeatCountAVAILABLE OCCUPIED, OCCUPIED, OCCUPIED
which is the same as:
getAvailableSeatCounttrue false, false, false
getAvailableSeatCountOCCUPIED OCCUPIED, OCCUPIED, OCCUPIED, OCCUPIED, OCCUPIED
getAvailableSeatCountAVAILABLE AVAILABLE, AVAILABLE, OCCUPIED
getAvailableSeatCount
public int getAvailableSeatCountboolean seatingChart
return ;
The crew determined that it would be nice to know how many rows on the plane are at full occupancy.
Each row has three seats and a row is at full occupancy if all three seats have someone sitting in them.
Using the boolean array, implement the logic to count the number of full rows on the plane.
Note: A new row starts at every third element. For example, row one begins with index row two begins with index and so on
Examples:
getNumberOfFullRowsOCCUPIED OCCUPIED, OCCUPIED, AVAILABLE, AVAILABLE, AVAILABLE
getNumberOfFullRowsAVAILABLE AVAILABLE, AVAILABLE, AVAILABLE, AVAILABLE, AVAILABLE
getNumberOfFullRowsOCCUPIED AVAILABLE, AVAILABLE, OCCUPIED, AVAILABLE, AVAILABLE
public int getNumberOfFullRowsboolean seatingChart
return ;
in java
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
