Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that reads a text file containing a number of test scores into an array and calculates the average and median of the

Write a program that reads a text file containing a number of test scores into an array and calculates the average and median of the scores. Define a constant to hold the array size and use it to declare the array that holds the scores. const int MAX_SCORES = 40; You will need to implement the following functions: int getScores (int scores[], int array_size, int& num_scores); This function should open the file lab6.txt and read the scores into an array. The function will return SUCCESS if it opens the file successfully and ERROR if the file cannot be open. Define SUCCESS and ERROR as global constants in your program. array_size is the maximum number of scores that you can read from the file. You need it to make sure you don't overstep the array boundaries. Even if the file has more than array_size scores, you can't read them all. The limit is array_size. num_scores will have the actual number of scores read from the file. You need it in case the actual number of scores found in the input file is less than the array size. double calcAverage (int scores[], int num_scores); This function should calculate and return the average of the scores passed as parameters. double calcMedian (int scores[], int num_scores); This function should return the median value in the array. To get the median, the array must be sorted first. Implement the SelectionSort function taught in class. Test your program with different input files. I will upload 3 different input files that you can use for testing on Canvas. This lab must be your own original code. Copies will receive zero grade regardless of who wrote the original and who copied.

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_2

Step: 3

blur-text-image_3

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

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

Describe the Indian constitution and political system.

Answered: 1 week ago

Question

Explain in detail the developing and developed economy of India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = X 52+7 - 1)(x+2) dx

Answered: 1 week ago

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago