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]
2 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]2 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
Ses
jekas [21]

Answer:

Amoung us

Explanation:

When the imposter is sus

8 0
3 years ago
Any single girls 12-14 im a 13 yo boy idc if this aint a dating site
-BARSIC- [3]

Answer:

THIS AN'T DATING APP

Explanation:

THIS IS THE ONE THE ONLY

BRAINY

5 0
3 years ago
Read 2 more answers
Which code segment results in "true" being returned if a number is odd? Replace "MISSING CONDITION" with the correct code segmen
seropon [69]

Answer:

b) num % 2 ==1;

Explanation:

Which code segment results in "true" being returned if a number is odd? Replace "MISSING CONDITION" with the correct code segment.

4 0
2 years ago
30 mins and I will give Brianlest what is the difference between a method and a function in which ways are they similar why do y
omeli [17]

Answer:

For 1), you should also add that methods in C++ are called member functions. Thus, the difference between functions and methods in this context is analogous to the difference between functions and member functions in C++. Furthermore, languages like Java only have methods. In this case, functions would be analogous to static methods and methods would have the same meaning. For 2), you should add that a method is able to operate on the private instance (member) data declared as part of the class. Any code can access public instance data.   A function is a mathematical construct. I would say all methods are functions but not all functions are methods

Explanation:

8 0
3 years ago
PLSSS HELLLP!!! THE CROWN WILL BE REWARDED FOR THE CORRECT ANSWER!!!
Sergio039 [100]

Answer:

The audience

Explanation:

The correct option is - The audience

Reason -

When writing a technical document -

Always describe things in technical terms.

Write for your readers.

Describe things exactly as they're described to you by subject matter experts.

Technical writing :

Addresses particular readers.

Helps readers solve problems.

4 0
2 years ago
Other questions:
  • Which type of address defines a single network interface in a computer or other device?
    7·1 answer
  • Someone asks you for help with a computer that hangs at odd times. You turn it on and work for about 15 minutes, and then the co
    7·1 answer
  • Question # 4
    8·2 answers
  • (Convert milliseconds to hours, minutes, and seconds) Write a function that converts milliseconds to hours, minutes, and seconds
    12·1 answer
  • Which type of loan is based on financial need
    6·1 answer
  • 2.3.4 CodeHS HTML Word Definitions
    10·1 answer
  • Plz hurry it’s timed
    5·1 answer
  • 6
    5·1 answer
  • List 100 social media with functions​
    7·1 answer
  • please help me to do this computer homework I beg you all please help me to get the answers please its important please ​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!