Question: Q 1 e ) ( 1 2 pts ) Create the following class Car class Car extends Vehicle implements Comparable, Announcements numDoors: int numWindows: int
Q e pts Create the following class Car
class Car extends Vehicle implements Comparable, Announcements
numDoors: int
numWindows: int
Carint numDoors, int numWindowsSEE NOTE
Carint numDoors, int numWindows, int numSeatsPerRow SEE NOTE
Carint numDoors, int numWindows, int numSeatsPerRow SEE NOTE
Carint numDoors, int numWindows, Person driver, int numSeatsPerRowSEE NOTE
canOpenDoorPerson p: boolean SEE NOTE
canOpenWindowPerson p: boolean SEE NOTE
getNumDoors: int
getNumWindows: int
equalsObject o: boolean SEE NOTE
toString: String SEE NOTE
compareToCar c: int SEE NOTE
Notes for Class Car:
This constructor calls the parent classs constructor, passing in for the numRows and for the numSeatsPerRow, before assigning the numDoors and numWindows values.
This constructor calls the parent classs constructor passing in for the numRows and the numSeatsPerRow argument, before assigning the numDoors and numWindows values.
This constructor calls the parent classs constructor passing in the numSeatsPerRow array as an argument, before assigning the numDoors and numWindows values.
This constructor calls the parent classs constructor passing in the driver and the numSeatsPerRow array, before assigning values to numDoors and numWindows.
This method returns true if the Person is seated in either of the exterior seats of a row that has a door column index or last index of that row and is over age It returns false otherwise.
If the number of doors is less than numberOfRows, the rows past numDoors hashave no doors.
This method returns true if the Person is seated in either of the exterior seats of a row that has a window column index or last index of that row and is over age It returns false otherwise. If the number of windows is less than numberOfRows, the rows past numWindows hashave no windows.
Two Car objects are considered equal if they have the same numDoors, same numWindows, same numberOfRows, same maxSeatsPerRow, and the same seat configuration numSeatsPerRowrow at every row.
Return a string containing the Cars details formatted as follows:
Car: number of doorsd number of windows d number of rowsd seats per rows names of people on boards
The seats per row will be from the array of numSeatsPerRow as valvalval valn
The names of people on board will be separated by commas with no trailing comma.
This method returns if the calling objects total number of seats is less than the passed in objects total number of seats, if the calling objects total number of seats is greater than the passed in objects total number of seats, if they have the same total number of seats.
Be sure to implement the loadPassenger, and loadPassengers methods in the Car class.
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
