Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

C++ please follow all requirements.
image text in transcribed
image text in transcribed
image text in transcribed
Program Description: 10th Statistics is a branch of mathematics dealing with the collection analysis, interpretation, presentation organization of data. In this prog as in maior cities banation of data. In this program, you will be conducting a statistical analysis over populations in major ciues ample, the following table shows all major cities with a population of 250.000 or more in the Midwestern region: Cities Population Rank City State 2015 Densus) Chicago IL 2,704,958 Columbus OH 860,090 Indianapolis IN 855,164 Detroit MI 672,795 Milwaukee WI 595,047 Kansas City MO 481.420 Omaha NE 446,970 Minneapolis MN 413,651 389,902 Wichita Cleveland OH 388,072 311,404 St. Louis St. Paul MN 302,398 Cincinnati OH 298,800 Lincoln NE 280,364 Toledo 279.789 0 Fort Wayne IN 264,488 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). OH Functions: size: e nim getData(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 int getaverage (const int *ptr. int This function should find the average of all cities. size) NOTICE: fractional population does not exist, so the return value must be casted to an integer void displayForward (const int . ptr, int 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. int getMax (const int *ptr, int size) 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 void display Backward (const int *ptr. int 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 void bubbleSort fint *ptr. int size) 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. teel free to add more functions if needed. 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 array, ptrul or data[]. You should only use ptr or ptr for accessing memory addresses or values. 5. You must demonstrate at least three different ways of using pointer. Y 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. U/**** 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 star 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 280364 264488 595047 389902 279789 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 446970 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What does that remind you of?

Answered: 1 week ago

Question

The neurons of the spinal cord are part of the nervous system.

Answered: 1 week ago