Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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

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

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

LO2 Identify components of workflow analysis.

Answered: 1 week ago