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
IPv4 address are of how many types?<br>​
Butoxors [25]

Answer: four different types

There are four different types of IPv4 addresses: public, private, static, and dynamic. While the public and private are indicative of the location of the network—private being used inside a network while the public is used outside of a network—static and dynamic indicate permanency.

7 0
3 years ago
Asymmetric encryption uses (choose all that apply):
yan [13]
Asymmetric uses two different keys (Public keys and private keys) for both encryption and decryption of data.  It is s any cryptographic<span> system that uses pairs of keys: public keys which may be distributed widely, and private keys which are known only to the owner.</span>
7 0
3 years ago
How many suggestions available in correcting misspelled words<br>​
Basile [38]

Spelling Checker, Grammarly, and there are many assets.

5 0
3 years ago
Given an initialized String variable message, and given a PrintWriter reference variable named output that references a PrintWri
vredina [299]

Answer:

The output streams to this question is "output.print(message)".

Explanation:

The description of the following can be given as:

  • In the given question it is define a string datatype variable that is "message".
  • Then we create a reference variable of PrintWriter class that is "output" and call string type variable that is message by the use of the print function we print message.  
7 0
3 years ago
Select the correct answer.
pochemuha

Answer:

Answer is will be D

Explanation:A is tablet is not able to make call

B: Handheld and consoles cant be because The console is usually used to write pieces of information from the program for the developer

c: Handhelds and phone cant be so

D: This is tablet is combined handhelds & computer ,you can call like tablet pc

I hope i help you

8 0
3 years ago
Read 2 more answers
Other questions:
  • What is the type of account and normal balance of allowance for uncollectible accounts?
    13·2 answers
  • Which statement about creating folders is TRUE?
    15·2 answers
  • How do you screen shot and copy paste the screenshot from chrome book
    11·2 answers
  • [17 PTS] What do you think of puzzle games?
    11·1 answer
  • Which of these is not considered a final step when creating a Podcast? Getting a loan to help with the cost of the equipment. Ch
    6·1 answer
  • First Person Who Answers Fast As Possible Will Be Marked As Brainiest ​
    12·1 answer
  • Select the three reasons that the gaming industry is set to grow.
    12·2 answers
  • Which button in the Sort &amp; Filter gallery of the Data tab would alphabetize from A to Z quickly?
    6·2 answers
  • What programming language supports relational databases?
    15·1 answer
  • What are the 49 questions for creat and edit Excel assessment​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!