Question: C++ please follow all requirements Program Description: Statistics is a branch of mathematics dealing with the collection, analysis, interpretation, presentation, and organization of data. In


Program Description: Statistics is a branch of mathematics dealing with the collection, analysis, interpretation, presentation, and organization of data. In this program. Vou will be conducting a statistical analysis over populations in major cities, For example, the following table shows all major cities with a population of 250,000 or more in the Midwestern region: Cities Rank City State Chicago IL Columbus OH Indianapolis IN Detroit MI Milwaukee wi Kansas City MO Omaha NE Minneapolis MN Population (2016 census) 2,704,958 860,090 855,164 672,795 595 047 481.420 446,970 413,651 389,902 388,072 311,404 302,398 298.800 280,384 279,789 264,488 Wichita KS 10 13 14 Cleveland OH St. Louis St. Paul MN Cincinnati OH Lincoln NE Toledo OH Fort Wayne IN 16 nimi To analyze these data, your program should do the following: You need an array with 16 integers (you can also try "long", "unsigned long" or "long long", since population can be a very large number. If you need a different data type, feel free to modify the parameter data types provided below) Have user enter all values, since user may want to analyze a different region Declare a pointer name "ptr", that is initialized to the starting location of the population array const int SIZE = 16; int *ptr; //dynamically allocate an array The program should then find the maximum, average, and display all elements forward and backwards, and sorting (with bubble sort) using three different ways of pointer access Remember, main function should serve as the "driver" to all, so your main function should only declare the variables and call the other functions (occasional cout statements are fine). Functions: Einom ngizzA gnimg019 - getData(int size) IM int getAverage (const int . ptr, int size: void displayForward (const int *ptr, int size); This function should prompt the user to enter the population of 16 cities. For testing purposes, you can also use populations from another group of cities. We do not accept user input less or equal to 0. Return the pointer This function should find the average of all cities. NOTICE: fractional population does not exist, so the return value must be casted to an integer Show all population from the first value to the last value. All numbers must be displayed in space of 10, left justified. Since there is a large amount of numbers, your display should show 4 numbers per line, use a counter to control this. Find the largest population. NOTICE: the largest value may not be the first value nor the last. You cannot call sort before calling getMax, since doing so will decrease the efficiency Show all population from the last value to the first value. All numbers must be displayed in space of 10, left justified. Since there is a large amount of numbers, your display should show 4 numbers per line, use a counter to control this. This function will sort all population numbers from the smallest to the biggest. You probably also need to add a swap function to make sort work. int getMax (const int *ptr, int size): void displaybackward (const int *ptr, int void bubbleSort(int *ptr, int size) *Eeel free to add more functions Other requirements: 1. You can enter the population data I provided in the table from console. 2. Follow programming style guideline very carefully. a. Points will be taken off for all violations 3. Your output style has to match with my output shown below (although you can try different user input). 4. When accessing array, use only pointer syntax. Do not use arrayptril, or data. You should only use ptror ptr for accessing memory addresses or values. 5. You must demonstrate at least three different ways of using pointer. 6. NO global variables in this assignment 7. All functions must have prototypes. 8. Store all values as variables, do not hardcode any values (for example: size should be saved as a variable) Use constant variables as much as possible 9. Use a line separator between all function definitions. V/****101stars *****") 10. All assignments must be submitted and run as specified to pass the course see syllabus 11. Copy and paste your output at the end of your program. Comment out the output lines 12. Submit your program.cpp only) on world classroom before deadline Sample output: Please enter population of the 16 cities: 860090 2704958 855164 264488 672795 481420 446970 595047 298800 413651 388072 389902 311404 302398 280364 279789 display forward: 860090 2704958 672795 481420 298800 413651 311404 302398 855164 446970 388072 264488 595047 389902 279789 280364 display backward: 279789 280364 389902 388072 595047 446970 264488 855164 302398 413651 481420 2704958 311404 298800 672795 860090 average is: 596582 max is: 2704958 after sorting, displaying forward: 264488 279789 280364 298800 302398 311404 388072 389902 413651 446970 481420 595047 672795 855164 860090 2704958 after sorting, display backward: 2704958 860090 855164 672795 595047 481420 44 6970 413651 389902 388072 311404 302398 298800 280364 279789 264488 Press any key to continue ... *Notice* I pressed the tab key between all numerical value entries. The returned line is a result of copy and paste from console to MS word, not because I pressed space bar sometimes and "enter" key some other times
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
