Question: In this program you will write a C++program to analyze a small subset of the data that has been collected.See file cityCensus.txt .Use precisely fiveparallel

In this program you will write a C++program to analyze a small subset of the data that has been collected.See file cityCensus.txt .Use precisely fiveparallel arrays: oneforname of city, one for total population, one for average age of residents, one for number of households,and one for the average number ofpeople per household.Note that the average number of people per household is not read in but it is calculated by dividing the total population by the number of households.Assume a maximum of 100cities.An output file is opened in main() and remains open until the end of the execution.Input:Write a functionto input the name of each city, the total population, the average age of residents, and the number of households.Repeat until end of file. Use getline(file, string name) to input text with spaces. You will find a very mischievous character to deal with both after the name of the cityand at the end of the five numericalvalues. You will enjoy knowing about file.ignore(). You may do the calculation of the average number of people per household as you are reading the input and store this value in the fifth array.Output:Write a separate function to output to the file all city census informationwith name of city, total population, average age, and average number of people per household. NOTE THAT THE NUMBER OF HOUSEHOLDS IS NOT BEING OUTPUT.Processing: Call the output function to outputto a fileall data in the original order.Write a separate function to compute and return the average population for all cities. Do not output from this function but return the valueand print it out to the screenfrom main().Write one and only one function to return the subscript of the citywith the highest average age. There is no output in this function. Do not assume a sorted array. In main(),the name(s) of the cities with the highest average age is to be output to the screen.Extra credit will be given for covering the possibility of multiple cities with same highest age. Use a selection sort to sort citiesby populationin descending order. This is written as a separate function with no output.Write the sorted array to the file.Write a function to prompt the user for the name of a city. Output to the filefrom this functionthe population, average age, and average number of people per household or output message No such cityin the list.THEME ISSUES:one-dimensional arrays,if statements, file input,file output, searching, sortingAbsolutelyno two-dimensional arrays, no structures and no menu function.Sample output before sorting:

City Population Average Age Average numberPeople/householdACTON 7993 45.2 2.9AERIAL ACRES 3074 27.0 2.9BREA 3613 38.6 3.1CITY RANCH 50798 37.0 3.2COMMERCE 45903 28.4 4.3CRYSTALAIRE 1259 52.4 2.2DEL SUR 70918 34.4 3.4. . . .

input file:

ACTON

7993 45.2 2729

AERIAL ACRES

3074 27 1056

BREA

3613 38.6 1154

CITY RANCH

50798 37 15963

COMMERCE

45903 28.4 10727

CRYSTALAIRE

1259 52.4 569

DEL SUR

70918 34.4 20964

ELIZABETH LAKE

2932 41.7 1079

FIRESTONE PARK

57110 26.6 12971

FRAZIER PARK

5077 44 2080

FULLERTON

51767 36 15849

GORMAN

1699 40.9 623

HI VISTA

72046 28.3 20672

HOLLYWOOD

45151 38.3 21929

JUNIPER HILLS

2138 43.3 816

LAKE LOS ANGELES

7285 30.9 1982

LOS ANGELES

51223 25.5 11731

MARICOPA

4176 38.4 647

PALMDALE

38158 28.4 9690

PEAR BLOSSOM

388 44.5 103

PINON HILLS

6220 41.8 2198

PIRU

2031 29.3 522

ROSAMOND

18910 32.4 6469

SIMI VALLEY

54366 39 18650

WRIGHTWOOD

4894 44.1 1998

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!