Design a project in C to collect household information for a census bureau which should obtain and analyze household information within the Greater Toronto Area.
Data Collected:
• Date of collection of data using MM/DD/YYYY format
• Regions:
o Peel
o York
o Durham
• Towns – required
o For Peel
Brampton
Mississauga
o For York
Maple
Vaughan
o For Durham
Whitby
Oshawa
• Race of head of household – required (Caucasian, Indigenous, African American, Asian, Other)
• Number of people in the household – required, must be greater than 0
• The household yearly income – required, must be numeric, must be greater than 0.
Instructions
Create an application that should:
• Get information for five households from the use with data validation and then randomly populate valid information in an array of structures of 100 households;
• Use text-based menu driven interface to perform following actions based on user input in a loop.
•
A. Total Households Surveyed per region: it should show total of the overall surveyed by town and region. (see the following example).
B. Total Households Surveyed per Race: Will show the total of the overall surveyed by town and region. (see the following example ).
C. Average Household Income: Show the overall average household income for those that are surveyed.
D. Average Household Income by town and region: Will display the average household income by town and region.
E. Average Household Income by race: Will display the average household income by race (see below for an example).
F. Percentage below Poverty: Show the overall percentage of those below poverty based on the table below for all data collected.
G. Percentage below Poverty by town and region: Show the overall percentage of those below poverty based on the table below for all data collected by town and region (see below for an example).
H. Percentage below Poverty by race: Show the overall percentage of those below poverty based on the table below for all data collected by race (see below for an example).
Note: approximate average/total income to nearest hundred and percentage to nearest integer.
• Create a well-designed modular program based on design techniques taught;
• Make appropriate use of a header file;
• Use good naming conventions for all variables and functions;
• Use enumerated data types where appropriate;
• AND YOU MUST USE STRUCTRES CORRECTLY.
Example layout of data for the various queries above:
Average Household Income
Peel: $30,000
Brampton: $40,000
Mississauga: $20,000
Durham: $37,500
Oshawa: $40,000
Whitby: $35,000
Basis of Poverty:
• Household of 1 and less than $15,000
• Household of 2 and less than $20,000
• Household of 3 and less than $25,000
• Household of 4 and less than $30,000
• Household of 5 or more and less than $40,000
C PROGRAM:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct HouseHold
{
char Region[50],Town[50];
char RaceHead[50];
int NoPl;
int income;
}House;
House *H;
int Region_validator(char R[50])
{
if(!(strcmp(R,"Peel")))
{
return 1;
}
else if(!(strcmp(R,"York")))
{
return 1;
}
else if(!(strcmp(R,"Durham")))
{
return 1;
}
else
{
return 0;
}
}
int Town_validator(char R[50],char t[50])
{
if(!(strcmp(R,"Peel")))
{
if(!(strcmp(t,"Brampton")))
{
return 1;
}
else if(!(strcmp(t,"Mississauga")))
{
return 1;
}
else
{
return 0;
}
}
else if(!(strcmp(R,"York")))
{
if(!(strcmp(t,"Maple")))
{
return 1;
}
else if(!(strcmp(t,"Vaughan")))
{
return 1;
}
else
{
return 0;
}
}
else
{
if(!(strcmp(R,"Whitby")))
{
return 1;
}
else if(!(strcmp(t,"Oshawa")))
{
return 1;
}
else
{
return 0;
}
}
}
int Race_validator(char R[50])
{
if(!(strcmp(R,"Caucasian")))
{
return 1;
}
else if(!(strcmp(R,"Indigenous")))
{
return 1;
}
else if(!(strcmp(R,"African")))
{
return 1;
}
else if(!(strcmp(R,"American")))
{
return 1;
}
else if(!(strcmp(R,"Asian")))
{
return 1;
}
else if(!(strcmp(R,"Other")))
{
return 1;
}
else
{
return 0;
}
}
void Get_Input(int n)
{
int i;
for(i=0;i<n;i++)
{
int c=0;
printf("\t\tHOUSEHOLD %d",i+1);
printf("\nREGIONS\n1.Peel\n2.York\n3.Durham");
printf("\nEnter a Region from above:");
scanf("%s",H[i].Region);
if(Region_validator(H[i].Region))
{
if(!(strcmp(H[i].Region,"Peel")))
{
printf("Town\n1.Brampton\n2.Mississauga");
printf("\nEnter a Town from above:");
scanf("%s",H[i].Town);
if(!(Town_validator(H[i].Region,H[i].Town)))
{
c++;
}
}
else if(!(strcmp(H[i].Region,"York")))
{
printf("Town\n1.Maple\n2.Vaughan");
printf("\nEnter a Town from above:");
scanf("%s",H[i].Town);
if(!(Town_validator(H[i].Region,H[i].Town)))
{
c++;
}
}
else
{
printf("Town\n1.Whitby\n2.Oshawa");
printf("\nEnter a Town from above:");
scanf("%s",H[i].Town);
if(!(Town_validator(H[i].Region,H[i].Town)))
{
c++;
}
}
}
else
{
c++;
}
if(c!=0)
{
i--;
printf("\tWRONG CHOICE\n\n");
continue;
}
printf("Race\n1.Caucasian\n2.Indigenous\n3.African\n4.American\n5.Asian\n6.Other");
printf("\nEnter a Race from above:");
scanf("%s",H[i].RaceHead);
if(!(Race_validator(H[i].RaceHead)))
{
i--;
printf("\tWRONG CHOICE\n\n");
continue;
}
printf("Enter No of People in HouseHold:");
scanf("%d",&H[i].NoPl);
printf("Enter Annual income of the HouseHold:");
scanf("%d",&H[i].income);
}
}
void query(int n)
{
int Region[3]={0,0,0},i;
int Race[6]={0,0,0,0,0,0};
int Town[3][2]={{0,0},{0,0},{0,0}};
int total_in=0,total_incm_region[3]={0,0,0};
int
total_incm_town[3][2]={{0,0},{0,0},{0,0}},total_incm_race[6]={0,0,0,0,0,0};
for(i=0;i<n;i++)
{
total_in+=H[i].income;
if(!(strcmp(H[i].RaceHead,"Caucasian")))
{
Race[0]++;
total_incm_race[0]+=H[i].income;
}
else if(!(strcmp(H[i].RaceHead,"Indigenous")))
{
Race[1]++;
total_incm_race[1]+=H[i].income;
}
else if(!(strcmp(H[i].RaceHead,"African")))
{
Race[2]++;
total_incm_race[2]+=H[i].income;
}
else if(!(strcmp(H[i].RaceHead,"American")))
{
Race[3]++;
total_incm_race[3]+=H[i].income;
}
else if(!(strcmp(H[i].RaceHead,"Asian")))
{
Race[4]++;
total_incm_race[4]+=H[i].income;
}
else
{
Race[5]++;
total_incm_race[5]+=H[i].income;
}
if(!(strcmp(H[i].Region,"Peel")))
{
total_incm_region[0]+=H[i].income;
Region[0]++;
if(!(strcmp(H[i].Town,"Brampton")))
{
total_incm_town[0][0]+=H[i].income;
Town[0][0]++;
}
else if(!(strcmp(H[i].Town,"Mississauga")))
{
total_incm_town[0][1]+=H[i].income;
Town[0][1]++;
}
}
else if(!(strcmp(H[i].Region,"York")))
{
total_incm_region[1]+=H[i].income;
Region[1]++;
if(!(strcmp(H[i].Town,"Maple")))
{
total_incm_town[1][0]+=H[i].income;
Town[1][0]++;
}
else if(!(strcmp(H[i].Town,"Vaughan")))
{
total_incm_town[1][1]+=H[i].income;
Town[1][1]++;
}
}
else
{
total_incm_region[2]+=H[i].income;
Region[2]++;
if(!(strcmp(H[i].Town,"Whitby")))
{
total_incm_town[2][0]+=H[i].income;
Town[2][0]++;
}
else if(!(strcmp(H[i].Town,"Oshawa")))
{
total_incm_town[2][1]+=H[i].income;
Town[2][1]++;
}
}
}
printf("\n\n\t\t\tCENSUS");
printf("\n\t\tTotal Households Surveyed BY Region");
printf("\nPeel:%d",Region[0]);
printf("\nYork:%d",Region[1]);
printf("\nDurham:%d",Region[2]);
printf("\n\t\tTotal Households Surveyed BY Race");
printf("\nCaucasian:%d",Race[0]);
printf("\nIndigenous:%d",Race[1]);
printf("\nAfrican:%d",Race[2]);
printf("\nAmerican:%d",Race[3]);
printf("\nAsian:%d",Race[4]);
printf("\nOther:%d",Race[5]);
printf("\n\t\tAverage HouseHold Income:%d",total_in/n);
printf("\n\t\tAverage HouseHold Income By town and Region");
printf("\nPeel:%d",total_incm_region[0]/((Region[0]==0)?(1):(Region[0])));
printf("\nBrampton:%d",total_incm_town[0][0]/((Town[0][0]==0)?(1):(Town[0][0])));
printf("\nMississauga:%d",total_incm_town[0][1]/((Town[0][1]==0)?(1):(Town[0][1])));
printf("\nYork:%d",total_incm_region[1]/((Region[1]==0)?(1):(Region[1])));
printf("\nMaple:%d",total_incm_town[1][0]/((Town[1][0]==0)?(1):(Town[1][0])));
printf("\nVaughan:%d",total_incm_town[1][1]/((Town[1][1]==0)?(1):(Town[1][1])));
printf("\nDurham:%d",total_incm_region[2]/((Region[2]==0)?(1):(Region[2])));
printf("\nWhitby:%d",total_incm_town[2][0]/((Town[2][0]==0)?(1):(Town[2][0])));
printf("\nOshawa:%d",total_incm_town[2][1]/((Town[2][1]==0)?(1):(Town[2][1])));
printf("\n\t\tAverage HouseHold Income By Race");
printf("\nCaucasian:%d",total_incm_race[0]/((Race[0]==0)?(1):(Race[0])));
printf("\nIndigenous:%d",total_incm_race[1]/((Race[1]==0)?(1):(Race[1])));
printf("\nAfrican:%d",total_incm_race[2]/((Race[2]==0)?(1):(Race[2])));
printf("\nAmerican:%d",total_incm_race[3]/((Race[3]==0)?(1):(Race[3])));
printf("\nAsian:%d",total_incm_race[4]/((Race[4]==0)?(1):(Race[4])));
printf("\nOther:%d",total_incm_race[5]/((Race[5]==0)?(1):(Race[5])));
}
void main()
{
int n,i;
printf("Enter No.of HouseHold:");
scanf("%d",&n);
H=(House *)malloc(n*sizeof(House));
Get_Input(n);
query(n);
}
Design a project in C to collect household information for a census bureau which should obtain and analyze household inf...
Problem Statement You are to create a Visual Basic(VB) project for a census bureau to obtain and analyze household income survey data within the Pittsburgh area (including Morgantown Ky). Data Collected: Home identification code (4 alphanumeric characters) – required Program should generate it using a random number generator. You won’t use this anywhere it just need to be generated. Generate the first number in the Form Load event and then each subsequent number in the button click. See attached code...
Why Malaysians need a well-comprehensive social safety nets program? Achieving high growth while ignoring the welfare of the lower income group is an unwarranted act. Like the rest of the world, Malaysia suffers from the increasing gap between the rich and the poor despite the low incidence of absolute poverty today compared to in 1970s. Urban poverty is rising too together with the relative poverty due to income inequalities within and among the ethnic groups and the different social sectors....
Here is the text book information, trend needs to be return on investment Calculate one financial statement ratio trend within your industry that warrants improvement efforts. Make up your own. Return on Investment LO 2 Explain the importance and show the calculation of return on investment. Imagine that you are presented with two investment alternatives. Each investment will be made for one year, and each investment is equally risky. At the end of the year you will get your original...
this is all the information given Personal Financial Planning Mini-Case Jeff and Mary Douglas, a couple in their mid-30s, have two children - Paul age 6 and Marcy age 7. The Douglas' do not have substantial assets and have not yet reached their peak earning years. Jeff is a general manager of a jewelry manufacturer in Providence, RI while Mary teaches at the local elementary school in the town of Tiverton, RI. The family needs both incomes to meet their...
Please use own words. Thank you. CASE QUESTIONS AND DISCUSSION > Analyze and discuss the questions listed below in specific detail. A minimum of 4 pages is required; ensure that you answer all questions completely Case Questions Who are the main players (name and position)? What business (es) and industry or industries is the company in? What are the issues and problems facing the company? (Sort them by importance and urgency.) What are the characteristics of the environment in which...
The following guidelines outline the basic template for a robot vacuum cleaner game. The game must be implemented in c programming language. It mimics a robotic vacuum cleaner. The code must only use the following libraries: #include <math.h> #include <stdlib.h> #include <string.h> #include <limits.h> and any .graphics and .timers libraries. The guidelines are outlined as follows: Terminal Set-up: you may assume that the terminal will be quite large, for example, on the order of 150×50, or more. Status Display: The...
ARE MY ANSWERS CORRECT? 25 questions 1. what an A/R aging analysis is, its purpose, and how it is created. Used to estimate amount needed in Allowance for Bad Debts Account (a contra account) A/R Days Outstanding 0-30 31-60 61-90 Over 90 Under each term list all A/Rs that are not paid by date Use historical experience to estimate the percentage of A/R for each date period to determine allowance for Bad Debts What the three major cost components are...
Compensation sessionABC International: Solving the Rural BarrierSource: Thunderbird School of Global Management, A unit of the Arizona State University Knowledge Enterprise. 2015. This case was prepared by Erin Bell under the guidance and supervision of Dr. Amanda Bullough, and revised and updated by Drew Helm for the purpose of classroom discussion only, and not to indicate either effective or ineffective managementSiham sat with her family and childhood friend, Leila, in their rural village of Qabatiya, Palestine. Leila had recently returned from...
The following guidelines outline the basic template for a robot vacuum cleaner game. The game must be implemented in c programming language. It mimics a robotic vacuum cleaner. The code must only use the following libraries: #include <math.h> #include <stdlib.h> #include <string.h> #include <limits.h> and any .graphics and .timers libraries. The guidelines are outlined as follows: Terminal Set-up: you may assume that the terminal will be quite large, for example, on the order of 150×50, or more. Status Display: The...
23. What is the total net amount of capital gain reported on Form 1040? OA. $308 OB. $2,411 C. $2,719 OD. $2,900 Advanced Scenario 7: Mark and Barbara Matthews Directions Using the tax software, complete the tax return, including Form 1040 and all appropri- ate forms, schedules, or worksheets. Answer the questions following the scenario. Note: When entering Social Security numbers (SSNs) or Employer Identification Numbers (EINS), replace the Xs as directed, or with any four digits of your choice....