Home /
Expert Answers /
Computer Science /
do-not-copy-anything-from-the-internet-the-following-figure-shows-a-train-seat-numbering-plan-se-pa222
(Solved):
*Do not copy anything from the internet
The following figure shows a train seat-numbering plan. Se ...
*Do not copy anything from the internet
The following figure shows a train seat-numbering plan. Seat-numbering plan shows how the seats are laid out. In each row we have 4 seats. In total, we have 23 rows. Note: first and last row has 2 seats only. Step1: Create a Seat class that has: - Private int seatNumber with getter and setter methods. - Private String for passenger name with getter and setter methods. Note: if name is null this means seat is empty. - A constructor that takes seat number. - A method isEmpty that returns if the seat is empty or not. - A toString method that returns a string represents seat object's information. - A static method isValid that takes a seat number and returns if the seat number is valid or not. - A static method getRow that takes a seat number and returns the train row number if the seat number is valid. - A static method getColumn that takes a seat number and returns the train column number if the seat number is valid. Step 2: Draw the UML diagram for the Seat class Step 3: Create a Train class that has the following: - A private static ragged array of seats reflecting the mentioned train seat plan. - A method to reserve a seat. This method takes seat number and passenger's name. If the seat is empty, the seat will be reserved for the passenger and returns true. If not, it will returns false. - A method to delete a reserved seat. If the seat is not empty, the seat will be deleted and returns true. Else, it will returns false. - A method to delete all reserved seats.
Here I've provided the Answer for your question. Steps for isAnagram() method: 1. Convert both the string into lowercase 2. If the length of both the strings are different, then the strings are not anagrams, So return false 3. If the length of both t