Question: IN JAVA: Write a class encapsulating the concept of a house, assuming a house has the following attributes: value (in dollars) , a city location
IN JAVA:
Write a class encapsulating the concept of a house, assuming a house has the following attributes: value (in dollars), a city location, and number of bedrooms.
Your class name should be House and your code should be in a file called House.java. You will need to create this file (remember to NOT check the box to create a main method). In this class, include:
Private instance variables for the previously-mentioned attributes
A default constructor
An overloaded constructor
Accessor and mutator methods (i.e., get and set methods)
The toString method
The equals method Your default constructor should typically initialize the instance variables to some default values that you feel are appropriate (lets just go with a $100,000, 2-bedroom home in Azusa). The overloaded constructor should pass in values for value, city location and number of bedrooms which are used to initialize the class instance variables.
Also, use the provided template file (CS220_Lab11.java) as your client class to test all the methods in your class. So, you would want to test the default and overloaded constructors, as well as accessors, mutators, toString and equals methods. Since this is the first time youve ever thought about creating a client to test a user-defined class, weve included a sample of how you should do this below.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
