Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / 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

Computer Science

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 object’s state into text Now, write a client program named UseCar that demonstrates the system’s capabilities 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 car’s make, model, year, price, and the car’s owner information).

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE