Question: Reading the data from a file no user input The following problem statement is based on a problem in the C++ text by Friedman &
Reading the data from a file no user input
The following problem statement is based on a problem in the C++ text by Friedman & Koffman:
The results of a survey of the households in your township are available for public scrutiny. Each record (struct-type entity) contains input data for one household, including
- a four-digit integer identification number
- the annual income for the household
- the number of household members.
Assuming that no more than 25 households were surveyed, write program to:
A.read the survey results into an array of structures or objects.The inputting should continue until negative values (sentinel values) are encountered or 25 records are obtained (size of the array).In other words, the array may or may not fill up.
B.Count the number of households included in the survey and print (on the screen) a three-column table displaying the data.Display appropriate headers, prior to displaying the contents of the array of structs.
C.Calculate and display the average household income. Display theaverage household incomeusing an appropriate message,and list the identification number and income of each household that exceeds the average, using a two-column table.Display an appropriate message prior to displaying the two-column table.
D.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.
E.Display the percentage of households that have incomes below the poverty level, using an appropriate message, once it's been computed.
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
-1-1-1
if you use data files for inputting and outputting.
To receive the extra-credit points, your program must work fully, when you incorporate the above (that is, data files).In other words, no partial credit, if you're not doing the inputting/outputting of data properly using input/output data files.
an array of structures no user input, it should read from the data provided in E
use repl.it the website to write you code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
