Question: solve it with java 21. A car registration system stores information about two things: owner and cars. A car has attributes for make, model, and

21. A car registration system stores information about two things: owner and cars. A car has attributes for make, model, and year. The owner has attribute name. Assume that a car must be owned by one owner and an owner can own many cars where a car can either be a sports car or a minivan. Based on these details, below is a sample class diagram to illustrate the system components. Write a Java program to implement the following class and a Main class to show how each class are used to display owner name and owned cars. Note: Assign two cars for the owner, one sports car and one minivan. See Example output for expected result once the program is executed. Page 6 of 9 Method Details: 1. toStringO - this method should return information for: a. Owner-returns owner name. b. Car - returns make, model, and year. c. SportsCar - return Car details and transmissionOpt. d. MiniVan - returns Car details and seatCapacity. 2. addCar(Car) - add new Car to the owner carlist. 3. displayCarsO - display all Cars owned by the owner. 4. Setter Methods: a. set TransmissionOpt (String) - sets sports car transmission type (Manual or Automatic). b. setSeatingCapacity (int) - sets minivan seating capacity. Example Output: Name: Mohamnad A.1 Owned cars Make: Fenrari Model: F2e Year: 2020 Transmission: Manual Make: Kia Nodel: Van Year: 2022 Capacity: 8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
