Question
you will write C++ program to solve the problem However, rather than using an array of struct-type elements, you willset up a linked list of
you will write C++ program to solve the problem
However, rather than using an array of struct-type elements, you willset up a linked list of struct-type nodes,whereeach node hasthe following fields or use Classusingstruct-type:
- a four-digit integer identification number
- the annual income for the household
- the number of household members
- a pointer field, linking this node to the next node
The results of a survey of the households in your township are available for public scrutiny. Each record (struct-type entity) contains data for one household as shown above (highlighted in light green).
a. To do the inputting, use a loop to set up one node at a time .
- Once a node is set up and made part of the linked list,
- ask the user if more nodes are to be added.
- If so. go through the loop at least one more time;
- if not, exit the loop and start with the next step.
b. Write code to
- count the number of households included in the survey and
- print (on the screen) a three-column table displaying the data.
c. Write code to
- calculate the average household income, and
- list the identification number and income of each household that exceeds the average.
d. Write code to
- Determine the percentage of households that have incomes below the poverty level. Compute the poverty level income using the formula
p = $7000.00 + $850.00 (m - 2)
where m is the number of members of each household. This formula shows that the poverty level depends on the number of family members, m, and that the poverty-level income increases as m gets larger.
Test your program on the following data.
Identification NumberAnnual IncomeHousehold Members
104112,1804
106213,2403
132719,8002
148335,0007
190017,0002
211228,5006
234515,6232
32103,2006
36006,5005
360111,9702
47248,9003
621710,0002
92806,2001
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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