Question: Create a class named Household that includes data fields for the number of occupants and the annual income, as well as methods to get

Create a class named Household that includes data fields for the number of occupants and the annual income,

Create a class named Household that includes data fields for the number of occupants and the annual income, as well as methods to get and set each field. In addition, create a default constructor that automatically sets the occupants field to 1 and the income field to 0. Save this file as Household.java. Create an application named TestHousehold that demonstrates each method works correctly. Save the file as TestHousehold.java. a. Create an additional overloaded constructor for the Household class you created in Exercise 3a. This constructor receives an integer parameter and assigns the value tothe occupants field. Add any needed statements to TestHousehold to ensure that the overloaded constructor works correctly,save it, and then test it. b. Create a third overloaded constructor for the Household class you created in Exercises 3a and 3b. This constructor receives two parameters, the values of which are assigned to the occupants and income fields, respectively. Alter the TestHousehold application to demonstrate that each version of the constructor works properly. Save the application, and then compile and test it.

Step by Step Solution

3.47 Rating (167 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the implementation of the Household class and the TestHousehold application in Java as described in your question Householdjava public class Hou... 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 Programming Questions!