Question: Write a program that can be used to gather statistical data about the number of movies college sstudents see in a month. Your program should
Write a program that can be used to gather statistical data about the number of movies college sstudents see in a month. Your program should perform the following steps: 1) Ask the user how many students were surveyed, An array of integers with many elements should be dynamically allocated. 2) Allow the user to enter the number of movies each student saw into the array. 3) Calculate and display the average, median, and mode of the values entered. (Use the code below for median and mode functions) 4) Input Validation: Do not accept negative numbers for input double calcMedian(int arr, int num) double med if (num % 2 :-0) " is number of elements even? int mid1 num /2, mid2 (num/2)-1; med ((arr+ mid1) (arr mid2)/2.0 else med *(arr+(num /2); return med; int calcMode(int *array, int size) int frequencies nullptr int mode -1: // The mode, initialized to -1 int highest 0: The value with highest frequency int element O: To hold an element subscript int count 0;/ Loop counter frequencies makeArraytsize
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
