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
When can designers use rapid application development? HELP ASAP
Bess [88]

I pretty sure you it’s the third one c.

6 0
3 years ago
In the Mouse Properties window, you can
levacccp [35]
B- You can adjust the mouse's double-click speed.

Some computer mouse software (depends on brand) will allow you to set new tasks for the mouse to perform.  Sometimes there are mice that have extra buttons that can be programmed to do certain tasks.
6 0
4 years ago
NO LINKS OR SPAMS THEY WILL BE REPORTD<br><br> Click here for 50 points
storchak [24]

Answer:

I clicked bro

Explanation:

What now?

7 0
3 years ago
Read 2 more answers
Write a program to prompt the user for a positive integer: N. The program will repeatedly divide the input in half using a loop,
a_sh-v [17]

Answer:

using python to write the program

Explanation:

#To use the log function, the module must be imported

import math

n=int(input("Enter number to be halved"))

count=0

while(n>1):

   count=count+1

   n=n//2

print("The number halved is now ", n, "The is the ", count, "iteration")

x = math,log(2,(n))

print("The log of n is:", x)

5 0
3 years ago
What are the six external part of a computer
pashok25 [27]
I'm guessing you mean the six external parts as in input and output devices

Here are the six external parts:

>Keyboard

>Mouse

>Monitor

>Speakers

>Printer

>Microphone or USB...I think you can choose either one as they are components outside of the computer/external/ -I/O devices
5 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is a basic principle of improvement?
    13·1 answer
  • Which network component allows computers to communicate on a network without being connected directly to each other?
    9·1 answer
  • Although highly accurate navigational information from the GPS constellation is exploitable by adversary forces, it is unlikely
    5·1 answer
  • Computers are used to store, retrieve, and _____ data. manipulate mechanize memorize operate
    12·1 answer
  • Which element is represented by the electron configuration in example B? Example B: 1s22s22p63s23p64s1 Aluminum Cesium Potassium
    12·2 answers
  • Which of the following are NOT possible using the RANDOM(a, b) and DISPLAY(expression) abstractions?
    10·1 answer
  • Converting denary no 41 to binar
    12·1 answer
  • Anybody wana play 2k21
    9·2 answers
  • Look at (c), is it accurate? ​
    9·2 answers
  • States that processing power for computers would double every two years
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!