Question: 3. Write a java class called House. A House has an owner (a name String), an area (a double) and a date when the
3. Write a java class called "House". A House has an owner (a name String), an area (a double) and a date when the house was built (a java.util.Date class object). Write constructors and set and get methods for the House class, and a toString method which returns a String consisting of the information about the house (the owner's name, house area and when built). Also write a copy constructor and a clone method each of which performs deep copy of a House object. Write a client test program which creates a House object with made-up details and prints out the House details to the screen. It then uses the copy constructor to create a second House object which is a deep copy of the first House object, changes the owner and date of the second object and prints out the details of both first and second House objects to the screen. The program then creates a third House object by using the clone method of House class, changes the owner and date of the third object, and prints out the details of both first and third House objects to the screen.
Step by Step Solution
There are 3 Steps involved in it
Housejava package deepshallow import javautilDate public class House implements Cloneable String nam... View full answer
Get step-by-step solutions from verified subject matter experts
