Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using java thanks Q1. (a) Create a class named Household (save as Household.java) that includes a default constructor and two data fields (number of occupants

using java thanks

image text in transcribed

image text in transcribed

Q1. (a) Create a class named Household (save as Household.java) that includes a default constructor and two data fields (number of occupants and annual income). And then create a driver program (save as TestHousehold.java) to test the class. 5 marks) Sample output for driver program: General Output Configuration Household 1 Nunber of occupants: Annual Income: 0.00 Values have been modified Nuber of occupants 6 Annual Income: 25000.00 Process completed Modify the default constructor for the Household class to set the occupants field to 1 and annual income field to 0. And then, run the driver program again. (b) I mark) (c) Create an additional overloaded constructor for the Household class. This constructor receives an integer argument and assigns the value to the occupant field. Change any needed statements to driver program to ensure that the overloaded constructor works correctly. Save and test the changes made. (4 marks) Create a third overloaded constructor for the Household class. This constructor receives two arguments, the values of which are assigned to the occupant and income fields respectively. Add any needed statements to driver program to ensure that the overloaded constructor works correctly. Save and test the changes made. (4 marks) (d)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions