Question
Java Programming- Objects, Aggregation, and Inheritance, Polymorphism Consider the following problem specification: The system stores information about two things: Cars and CarOwners. A car has
Java Programming- Objects, Aggregation, and Inheritance, Polymorphism
Consider the following problem specification: The system stores information about two things: Cars and CarOwners. A car has attributes for make, model, year and vin number. The owner has attributes for name and address. Assume that a car must be owned by one owner, and an owner can own many cars, but an owner might not own any cars (perhaps the owner just sold them all, but we still want a record of that owner in the system). The system should account for two different kinds of cars, Sports cars and Sedan cars. A sport car has additional attributes for race stats, represented by integer value. A sedan car has attributes for number of doors and trunk size, also represented by integer values.
1- Design and draw a UML class diagram, including classes, class attributes, and class relationships (composition, aggregation, inheritance, etc.) 2- Implement all classes in your diagram using the Java programming language. Implement the relationships as shown in your diagram. Include a setter and getter methods for each attribute in each class. Also, make sure to use the toString() method whenever appropriate to translate the objects state into text. Add other methods as necessary. 3- Create a test program named UseCars that should make use of the above classes and displays some results. In this test application do the following: a. Create an ArrayList that stores references of any type of cars b. Create a method that request information about a new car owner. The method will collect this information and returns a reference of a newly instantiated owner. c. Create another method that requests information about a sport car. The method will instantiate a sports car and adds it to the array list. Create another method that does exactly the same but for sedan cars. d. Create a method that would find and display the information about a given care based on a provided VIN number. e. In your main method or any method that acts as a main method. Call the methods that you just created. In other words, create a few car owners, create a few cars of each kind. Search for a particular car and display its information, and finally display all the cars that are currently stored in the list.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started