1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ahat [919]
3 years ago
5

You are working for the census bureau and you need to write a program in C to do the following: a) count the number of people in

each of the following age groups: 0 - 18 infant, 18 - 29 young, 29 - 50 middle aged, 50 - 69 old, 69 - and older, really old. Report the number of people in each age group. (use some random data for test). b) they need some statistics regarding the distribution of ages. Write a program to read in a number of ages. Compute the average age (mean) and the mode i.e. the age that occurs most frequently (be careful, some of the ages might be the same). Ages should be read in as integers, the average should be a real number. Calculate also the standard deviation using the formula:
Computers and Technology
1 answer:
valina [46]3 years ago
8 0

Answer:

See explaination

Explanation:

#include<iostream>

#include<stdio.h>

#include<conio.h>

#include<math.h>

using namespace std;

void main()

{

int RandomData[]={10,5,20,45,20,66,25,31,20,70}; //Random Data

int infant=0,young=0,middle=0,old=0,older=0; //To store count

int n,freq,count=0,high=0; //to store mode and other

double stdDev,mean,sum=0; //to store stdDev mean and sum

for(int i=0;i<(sizeof(RandomData)/sizeof(RandomData[0]));i++) //loop to count

{

if(RandomData[i]>0&&RandomData[i]<=18)

infant++;

else if(RandomData[i]>18&&RandomData[i]<=29)

young++;

else if(RandomData[i]>29&&RandomData[i]<=50)

middle++;

else if(RandomData[i]>50&&RandomData[i]<=69)

old++;

else if(RandomData[i]>69)

older++;

}

double first=0,sec=0; //to store result of stdDev formula first and second part

for(int i=0;i<(sizeof(RandomData)/sizeof(RandomData[0]));i++) //loop to calculate mean mode and stdDev

{

n=RandomData[i];

count=0;

for(int j=0;j<(sizeof(RandomData)/sizeof(RandomData[0]));j++)

{

if(n==RandomData[j])

count++;

}

if(high<count)

{

freq=RandomData[i];

high=count;

}

first+=(pow((RandomData[i]),2)/(sizeof(RandomData)/sizeof(RandomData[0])));

sec+=RandomData[i]/(sizeof(RandomData)/sizeof(RandomData[0]));

sum+=RandomData[i];

}

mean=sum/(sizeof(RandomData)/sizeof(RandomData[0]));

stdDev=sqrt(first-pow((sec),2));

/*------Printing Result-----*/

cout<<"\nCount:\nInfant: "<<infant<<"\nYoung: "<<young<<"\nMiddle: "<<middle;

cout<<"\nOld: "<<old<<"\nOlder: "<<older;

cout<<"\n\nMean: "<<mean<<"\nMode: "<<freq<<"\nStandard Deviation: "<<stdDev;

/*-----------XXXX-------------*/

getch();

}

You might be interested in
Opinion paragraph should the driving age be raised 21 ​
Rzqust [24]

Answer:

no

Explanation:

I believe that the driving age should not be raised to the age of twenty-one because most teens have jobs, places to go, and responsibilities to take care of. As a teen, it would be useful to be able to drive to and from school, practices, and more because most times, parents are not always available.  Teens can also experience pre-adulthood which would mean taking care of car payments, insurance payments, and simple tasks as to learning how to get gas on their own.

5 0
3 years ago
What is a drone satellite?​
babymother [125]

Answer:

A satellite that can be controlled where to go.

Explanation:

4 0
3 years ago
A determinant is any attribute whose value determines other values within a column.
guajiro [1.7K]

Answer:

true

Explanation:

4 0
3 years ago
Discuss the advantages of Database approach to systemdevelopment
Sergeu [11.5K]

Answer:

Explained

Explanation:

Improved Data Sharing and Data Security

Proper database management systems help increase organizational accessibility to data, which in turn helps the end users share the data quickly and effectively across the organization.  A management system helps get quick solutions to database queries, thus making data access faster and more accurate.

Effective Data Integration

Implementing a data management system enhances an integrated picture of an organization’s operations. It becomes easy to see how processes in one segment of the organization affect other segments.

Increased productivity of end user

Deploying a database management system, will always result in the increased productivity of users.It empowers the end user to make well informed and quick decisions that can contribute in success and failure of any organization.

4 0
3 years ago
Gunther is filling in his own input mask. He wants to format the Social Security numbers of his clients. The field must contain
kati45 [8]
Last one I am not sure they
4 0
3 years ago
Other questions:
  • I was walking in the rain with my Tim’s on steeping over puddles full of pain
    7·2 answers
  • If an Administrator performs a clean install of Windows Server 2012 R2 on a new server, and then moves critical domain services
    9·1 answer
  • Two technicians are discussing MAP sensors. Technician A says that the MAP sensor should be replaced if anything comes out of th
    10·1 answer
  • In general, font size for software-generated presentation slides should be no smaller than __________ points.
    8·1 answer
  • The advantage of an electronic ____ is that the content can be easily edited and updated to reflect changing financial condition
    8·1 answer
  • 1.
    13·1 answer
  • How do films use camera shots?
    10·2 answers
  • 1
    5·2 answers
  • What is a fruitful function? Explain with help of programming example?<br> plz
    7·1 answer
  • Https://forms.gle/eP8F5eKC2AUaCsB67
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!