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
Step: 1
Housejava package deepshallow import javautilDate public class House implements Cloneable String nam...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