Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Write a program that calculates the average for five test scores, where the lowest score is dropped. In addition to the main function, the

C++

Write a program that calculates the average for five test scores, where the lowest score is dropped.

In addition to the main function, the program also has the following four functions:

1. getScore(): this function ask the user for a test score and validate the score in the range of 0 to 100, and then return the score

2. calcAverage(): this function takes the five scores as arguments, calculates and return the average.

3. findLowest(): this function takes the five scores as arguments and returns the lowest score. It should be called by calcAverage function, which uses the function to determine which of the five scores to drop.

4. display(): this function takes the average as argument and display it

An incomplete program is provided below, please insert your code:

/* This program get 5 scores and drop the lowest one, then calculate and display the average */ #include #include using namespace std; //function prototypes double getScore(); //score has to be 0 - 100 double findLowest(double, double, double, double, double); double calcAverage(double, double, double, double, double); void display(double); int main(int argc, char *argv[]) { //variable declaration double s1, s2, s3, s4, s5, avg; //call getScore 5 times s1 = getScore(); s2 = getScore(); s3 = getScore(); s4 = getScore(); s5 = getScore(); //call the calcAverage function avg = calcAverage(s1, s2, s3, s4, s5); //call display function display(avg); system("PAUSE"); return EXIT_SUCCESS; } /* getScore function: this function displays a prompt and get a score from the keyboard input validation is needed to make sure the score is 0-100. The function returns the score */ double getScore() { //add your code here } /* findLowest: this function returns the lowest score among the five scores */ double findLowest(double a, double b, double c, double d, double f) { //add your code here } /* calcAverage: this function calculates and returns the average after dropping the lowest */ double calcAverage(double a, double b, double c, double d, double f) { //call the findLowest function to get the lowest //calculate the average //return the average } void display(double a) { //display the avrage } 

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_2

Step: 3

blur-text-image_step3

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

ISBN: 0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago