Question: ( 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 2 seat, but a perion in a tier 2 seat can only be moved to a different tier 2 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.
1 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, fromCo1, toRow, and toCol represent valid row and
column positions in the theater.
The seat at fromRow, fromCol is not available.
*1
public boolean reassignSeat (int fromRon, int fromCol.
int toRow, int toCol)
 (b) Write the reassignSeat method, which attempts to move a person

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!