Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( b ) Write the reassignSeat method, which attempts to move a person from a source seat to a destination seat. The reassignment can be
b Write the reassignSeat method, which attempts to move a person from a source seat to a destination seat. The reassignment can be made if the destination seat is available and has the same or greater tier than the source seat that is it is equally or leas desirable For example, a person in a tier I seat can be moved to a different tier I seat or to a tier seat, but a perion in a tier seat can only be moved to a different tier seat.
The reassignSeat method has four int paramelers representing the row and column indexes of the source from and destination to seats. If the reassignment is possible, the source seat becomes available, the destination seat becomes unavailable, and the method returns true. If the seat reassignment is not possible, no changes are made to either seat and the method returns false. Assume that the source seat is occupied when the method is called.
Complete method xeassignSeat.
Retums true if a seat bolder was reassigned from the seat at fromRow, fromCol
to the seat at toRow, toCol; otherwise if returns false, as described in part b
Precondition: fromRow, fromCo toRow, and toCol represent valid row and
column positions in the theater.
The seat at fromRow, fromCol is not available.
public boolean reassignSeat int fromRon, int fromCol.
int toRow, int toCol
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