Problem Description

The results of a survey of the households in your township have been made available. Each record contains data for one household, including a four-digit integer identification number, the annual income for the household, and the number of members of the household. You may assume no more than 25 households were surveyed. Define a structure type named household_t to store the record for one family

You need to write two separate program files. The description of each program file is as follow:

Program 1

You need to write a program to create a binary data file of the household data. Data should be requested from the keyboard and written to the data file.

Identification Number Annual Income Household Members
1041 $12,180 4
1062 13,240 3
1327 19,800 2
1483 24,458 8
1900 17,000 2
2112 19,125 7
2345 17,623 2
3210 5,200 6
3600 9,500 5
3601 11,970 2
4725 9,800 3
6217 10,000 2
9280 8,200 1

Program 2

You need to write another program to read the household data from a binary data file. The program also calculates the average income, the household exceeding the average income, and the percentage of households having incomes below the poverty level. You need to use the same structure type household_t defined in the Program 1 above. Declare an array of the structures household_t [ 25 ] for up to 25 households.

The required user-defined functions are as follow:

  • Write a function to read the data from the data file created in Program 1 and store them into the array of structures.
  • Write a function to print the array of structures in a three-column table with the appropriate column headings.
  • Write a function to calculate the average income.
  • Write a function to find and display a listing of the identification number and income for each household exceeding the average income. The results must be in a two-column table with the appropriate column headings.
  • Write a function to determine the percentage of households having incomes below the poverty level. The poverty level income may be computed using the formula: P = $7500.00 + $950.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 the poverty level increases as m gets larger.
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.