Menu

[solved]-Write Console C Program Two Classes Householdcensus Class Householdcensus Class Declares F Q39069952

Write a console C# program that has two classes.

Household Census Class
The Household Census class declares four private arrays to store the following information respectively:
Names of heads of households (type string)
Annual income of household (type double)
Number of household members (type int)
Assistance code (type char)

The arrays should be declared inside class (they should not be global).

Each of the arrays should have a size of 10. NOTE: do not use collections such as Array List or List

The Household Census class also declares a private integer counter variable.

The House Hold Census class should have four public methods to perform the following tasks:

* A constructor method that initializes the counter to 0.

* An input Household Info() method. This method reads names, incomes, and members information into the arrays. It does this using a loop inside which are statements to input household name, income and number of members and save them in the arrays. The loop should repeat until a user enters ‘n’ in response to the question, “Do you have more households to enter? (y/n) ” The counter is increased by 1 for each household data set of name-income-members

* A determine Assistance() method that should have a loop to check the income and number of members of each household and save ‘Y’ if qualifies for assistance or ‘N’ if not in the assistance code array. A household qualifies for assistance if income is below the given levels below corresponding to household size:

Household Size* Maximum Income Level (Per Year)

1.$16,000

2 $22,000

3 $28,000

4 $33,000

5 $34,000

6 $45,000

7 $50.000

8 $55,000
*For households with more than eight people, add $5,000 per additional person.
This task is done by looping from an index of 0 to counter.

* A display Household Info() method. This receives all the arrays and the counter as parameters. It then loops through the parallel arrays to display a table in the following format (the names and numbers are just examples. They are replaced by actual numbers and amounts and names as input by the user):

HOUSEHOLD NAME ANNUAL INCOME NUMBER OF HOUSEHOLD MEMBERSASSITANCE?
—————————- ———————————————————— ——————-
Scott Teslo 5,234,867.12 5 N
Isen Konowa 27,555.00 6 Y
William Ghettis 123,456.78 3    N
AVERAGE INCOME 54,326.11

The headings are displayed before entering the loop. A loop runs from index of 0 to counter. Inside the loop is a single Console. WriteLine statement to display all contents of the arrays indexed by the current index. The average income line comes in a Console. Write Line after the loop.

Expert Answer


Answer to Write a console C# program that has two classes. Household Census Class The Household Census class declares four private a… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *