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
Im on Edge 2021 and i did an assignment that says, "Processing." The assignment won't give me a grade and says it is overdue. wh
lora16 [44]

Answer:

you could send a email to your teacher to fix the problem

Explanation:

3 0
3 years ago
The local area network software called a ____ server provides workstations with the authorization to access a particular printer
Oksana_A [137]

Answer:

I think Its a Wi-Fi

                         

6 0
2 years ago
Define a function called strip_punctuation which takes one parameter, a string which represents a word, and removes characters c
DaniilM [7]

Answer:

punctuation_chars = ["'", '"', ",", ".", "!", ":", ";", '#', '@']

def strip_punctuation(strWord):

   for charPunct in punctuation_chars:

       strWord = strWord.replace(charPunct, "")

   return strWord

Explanation:

The function is defined with a single argument.

A for loop is ran to check each character of the the word.

If a punction mark is present as a character in the word, it is removed.

The same word is returned but without the punctuation marks.

8 0
3 years ago
What is the smallest integer n (stored as a floating point value) such that n + 1.0 - n will produce 0.0 for: a) Single-precisio
Vedmedyk [2.9K]

Answer: The FP-s are stored as sign (1.)111111111111 - number of bits.

Also 24 bits resolution there can be 23 zeros

Explanation:

The –1·2²⁴ might be stored as -1 · 1.00000000000000000000000(1 ←the 2⁰), it depends on how the FFP “engine” manages this, it may also be code specific a n+1–n does return 1 but 1–n+n does not. you should carry out a test for a specific compiler/computer

This is what javascript does with double (k+=1; n-=1) e.g

the (k+=2; n-=2) should be used to pass ±0x20000000000000

4 0
3 years ago
Help pleaseee got 15 points on this
miskamm [114]
I belive it is vtr deck
4 0
3 years ago
Other questions:
  • Password procedures, information encryption software, and firewalls are examples of measures taken to address:
    13·1 answer
  • Why is the ipad not considered to be an enterprise-worthy device
    8·1 answer
  • When enter a function or formula in a cell, which is the character you must type?
    14·1 answer
  • Is it just me or is brainly not working right now? I am trying to add friends and it won't let me!
    5·2 answers
  • I have a problem with Instagram.
    11·1 answer
  • If you want to transfer information transform STM to LTM, it is essential that you make the information ______________________.
    9·1 answer
  • Which of the following is an example of data an Earth-observing satellite would collect?
    7·1 answer
  • Match the definitions of different business communication to the type of document
    7·2 answers
  • Help me please. i need you help​
    8·1 answer
  • Which of the following could be a method for an object-oriented class called Student?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!