Question: java ..ll stc KW LTE 1 * 83% 12:50 PM newocs.eng.ku.edu.kw Additional Exercise: Implement the following classes: 1. Class Car that includes the following instance



..ll stc KW LTE 1 * 83% 12:50 PM newocs.eng.ku.edu.kw Additional Exercise: Implement the following classes: 1. Class Car that includes the following instance variables: private int plateNumber // the car plate number private int year Model 1/ the car year model private string color // the car color The class should have the following: A constructor that initializes the three instance variables. Set and get methods for each instance variable. 2. class Car Service that includes two instance variables: private Array named carsArray of type Car. Private int data field named MaxSize for the array size. The class should have the following: A constructor that initializes the maxSize and creates the array. boolean search (int) that checks whether the Car object with plate number passed as a parameter exists in the array or not. boolean add (int,int, String) that creates and adds a Car object to the array if the car plate number passed as parameter does not exist in the array and if the array is not full. Car service() that removes the first Car from the array, shifts the array content to the left and returns the removed Car object. If the array is empty, the method returns null. void print that prints all cars in the array. 3. Write a test application named CarTest. In the main method, do the following: Create a Car Service object with max size = 5. Display a menu of choices as shown in the sample output. Follow the sample output to test all methods. Stop the program when the user enters choice 5. ..ll stc KW LTE 1* 83% 12:50 PM newocs.eng.ku.edu.kw Sample Output Enter your choices 1. Add cars 2. Service a car 3. Print available cars 4. Search for Car 5. Exit Enter Car plate number or -1 to Stop: Enter Year Model: 2010 Enter Car color: Enter Car plate number or -1 to Stop: Enter Year Model: Enter Car color: Enter Car plate number or -1 to Stop: 98765 Enter Year Model: Enter car color: White Enter Car plate number or -1 to Stop: 1. Add cars 2. Service a car 3. Print available cars 4. Search for a Car 5. Exit Car Plate Number Color Year Model eie 2014 2008 Blue 67890 98765 3: 1. Ad cars 2. Service a car 3. Print available cars 4. Search for a Car 5. Exit 12345 Car has been serviced 1. Mod cars 2. Service a car 3. Print available cars 11 stc KW LTE 1 * 83% 12:50 PM newocs.eng.ku.edu.kw Sample Output Enter your choice: 1. Add cars 2. Service a car 3. Print available cars 4. Search for Car Enter Car plate number or -1 to Stop: Enter Year Model: 2010 Enter Car color: Enter Car plate number or -1 to Stop: Enter Year Model: Enter Car color: Enter Car plate number or -1 to Stop: 98765 Enter Year Model: Enter car color: White Enter Car plate number or -1 to Stop: 1. Add cars 2. Service a car 3. Print available cars 4. Search for a Car 5. Exit Car Plate Number Color Year Model 2eie 2014 2008 Blue 67890 98765 3: 1. Ad cars 2. Service a car 3. Print available cars 4. Search for a Car 5. Exit 12345 Car has been serviced 1. Mod cars 2. Service a car 3. Print available cars ill stc KW LTE 1 * 83% 12:50 PM newocs.eng.ku.edu.kw 10 of 72 4. Search for a Car 5. Exit Enter the car plate number: 12365 The car was not found 1. Add cars 2. Service a car 3. Print available cars 4. Search for a Car 5. Exit Color Car Plate Number 67890 98765 Plate Member Year Model 2014 2ees 2014 White 1. Add cars 2. Service a car 3. Print available cars 4. Search for a Car
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
