Question: Problem 2 ( Objects , Classes, and Aggregation ) Consider the following system specifications: The system stores information about two things: cars and their owners.

Problem 2(Objects, Classes, and Aggregation)
Consider the following system specifications:
The system stores information about two things: cars and their owners. A car has attributes for
make, model, and year, and price. The car 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).
Create the two classes, Car and CarOwner with two constructors in each class, a default
constructor and another constructor that initializes attributes to arbitrary values to be known
when the object is constructed.
For each instance variable (attribute), create a set and get methods. The setter method one will be
used to set the value of the instance variable and the getter method will be used to get (return) the
current value of the instance variable. Also, make sure to use the toString() method whenever
appropriate to translate the objects state into text
Now, write a client program named UseCar that demonstarates the systems cababilities and
tests the methods in your classes. In this program, create an array list of cars and store in it at
least three car objects. Display the contents of this array (produce a nicely formatted description
of each car object such as cars make, model, year, price, and the cars owner information).
For this problem, you will also need to submit a UML class diagram showing the classes and the
relationship between these classes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This question is complete Heres a detailed solution to designing and implementing the Car and CarOwner classes along with a demonstration program UseCar Step 1 Define UML Class Diagram Car Class Attri... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!