Question: // Kehinde Awosanya #include #include #include #include using namespace std; const double PI = 3.141593; //calcualte the area of a circle of a given diameter

 // Kehinde Awosanya #include #include #include #include using namespace std; constdouble PI = 3.141593; //calcualte the area of a circle of agiven diameter double getArea(int diameter) double area = 0; area = PI* pow(static_cast double>(diameter) / 2, 2); return area; //end of getArea functionNAN * ***** *******************readInt**** description: Reads and validates an Int in the

// Kehinde Awosanya #include #include #include #include using namespace std; const double PI = 3.141593; //calcualte the area of a circle of a given diameter double getArea(int diameter) double area = 0; area = PI * pow(static_cast double>(diameter) / 2, 2); return area; //end of getArea function NAN * ***** *******************readInt**** description: Reads and validates an Int in the range between min and max errorMsg: decribes the type of data or reenter if error encountered min: the minimum acceptable value max: the maximum acceptable value precondition: user has been prompted for input errorMsg may be assigned a value, otherwise defaukt arguments are INT_MIN and INT_MAX uses headwr files: iostream, string, limits, cctype postcondition: a valid integer in the range min to max is returned int readInt(string errorMsg, int min, int max) int some Int; //stores each integer entered bool valid = false; //looop control flag indicating validity of entry 1/initially assume not valid I read an integer delimited by a whitespace character cin >> someInt; // valid if within min to max range; valid = some Int >= min && someInt :: max(), ' '); valid = false; // no valid entry has been read } while (!valid); // while not valid continue executing do while loop // when valid input received, remove from input stream up to 100 remaining // characters or until reaches the ' ' character cin.ignore(100, ' '); return some Int; // return a valid integer to calling environment // ****************readDouble***** description: Reads and validates an double in the range between min and max errorMsg: decribes the type of data or reenter if error encountered min: the minimum acceptable value max: the maximum acceptable value precondition: user has been prompted for input errorMsg may be assigned a value, otherwise defaukt arguments are -DBL_MAX and DBL_MAX uses headwr files: iostream, string, limits, cctype postcondition: a valid double in the range min to max is returned double readDouble(string errorMsg, double min, double max) double someDouble; bool valid = false; //stores each double entered //loop control flag indicating validity of entry // initially assume not valid / read a double delimited by a whitespace character cin >> someDouble; // valid if within min to max range; valid = someDouble >= min && someDouble :: max(), ' '); valid = false; // no valid entry has been read } while (!valid); // while not valid continue executing do while loop // when valid input received, remove from input stream up to 100 remaining // characters or until reaches the ' ' character cin.ignore(100, ' '); return someDouble; environment // return a valid double to calling Scanned with CamScanner Page 2 of 2 The main function should repeatedly call the following two functions, allowing entry of multiple sets of data using an event controlled loop that asks the user to give a yes or no answer as to whether or not they would like to enter a set of student test scores for averaging. Call your readChar function to get user's response. 5. getStudentAverage function Code a void function that uses two reference parameters to return a name of type string& and an average of type double& to the calling environment. This function will: - Prompt for and get the student's name by calling the string class getline function. - Prompt for and get the four test scores for the student by calling the readint function for each test score and storing each in a local variable - will need four local variables. A valid - test score will be in the range 0 to 100. - Pass the four test scores to the min function to find and return the minimum score. - Calculate the total of the highest three test scores. - Call the average function to calculate the average of those three scores. - Return the student's name and the test average to the calling environment (main in this case). 6. displayStudentAverage function Code a void function to display information to the screen. This function should receive as value parameters the student's name and average and display those values to the screen along with identifying text. Display the average with one decimal digit of precision. Run an adequate set of test data and have another student examine your program prior to demonstrating to instructor and submitting for grading. Don't forget to submit the Hierarchy Chart! Scanned with CamScanner COSC 1336, M8e PA5-Drop Lowest Score Sequence, Selection, Logical and Relational Operations (Chap 4), Iteration (Chap 5), String class Processing (Chap 3), Reference Parameters (Chap 6) and Program Abstraction s the Write an iterative program that calculates the average of a group of test scores for a class of student lowest score in the group is dropped from the calculation. First, read through the entire assignment and develop a HIERARCHY CHART of the function calls and the data that will be passed between them. Submit this chart for grading. This may be hand drawn and submitted on power. Create a new programming project and add your library files to it. Next code the following two functions as described below. Apply bottom-up design coding main driver routings for testing each of the following functions. Comment out and keep the driver test code and results for later review. 1. average function Code a generic, reusable value returning function of type double that has two value parameters; a double for the sum total of the values to average and an integer for the count of number of values to be averaged. The function will calculate and return a floating-point average as a double. Check for invalid division by zero. If a valid average cannot be calculated, the function should return 0.0. When fully implemented and tested, move to your library files. 2. min function Code a generic, reusable value returning function of type int that has four value parameters to receive four integers. The function will use IF selection statements and the logical operators (AND) && and/or (OR) II, and relational operators (, >=) to find and return the lowest of four integer values received. (Do NOT code to use an array structure or code without using either the && or II operators!) When fully implemented and tested, move to your library files. - TEST THOROUGHLY!!! Include test sets with values in ascending, descending and mixed orders and a set with all values the same amount. When fully implemented and tested move to your library files. - TEST THOROUGHLY and keep test code. 4. main function Code a main function with the following user interface according to the specification given below: Program Calculates the average of 4 Tests after Dropping the Lowest Score. Would you like to find a student's average? (Y or N): Y Enter students name: John Doe Enter Test 1 Score: 99 Enter Test 2 Score: 97 Enter Test 3 Score: 100 Enter Test 4 Score: 90 Students Name: John Doe Average calculated using three highest test scores: 98.7 Find another student's average? (Y or N): y 2/19/2020 Scanned with CamScanner // Kehinde Awosanya #include #include #include #include using namespace std; const double PI = 3.141593; //calcualte the area of a circle of a given diameter double getArea(int diameter) double area = 0; area = PI * pow(static_cast double>(diameter) / 2, 2); return area; //end of getArea function NAN * ***** *******************readInt**** description: Reads and validates an Int in the range between min and max errorMsg: decribes the type of data or reenter if error encountered min: the minimum acceptable value max: the maximum acceptable value precondition: user has been prompted for input errorMsg may be assigned a value, otherwise defaukt arguments are INT_MIN and INT_MAX uses headwr files: iostream, string, limits, cctype postcondition: a valid integer in the range min to max is returned int readInt(string errorMsg, int min, int max) int some Int; //stores each integer entered bool valid = false; //looop control flag indicating validity of entry 1/initially assume not valid I read an integer delimited by a whitespace character cin >> someInt; // valid if within min to max range; valid = some Int >= min && someInt :: max(), ' '); valid = false; // no valid entry has been read } while (!valid); // while not valid continue executing do while loop // when valid input received, remove from input stream up to 100 remaining // characters or until reaches the ' ' character cin.ignore(100, ' '); return some Int; // return a valid integer to calling environment // ****************readDouble***** description: Reads and validates an double in the range between min and max errorMsg: decribes the type of data or reenter if error encountered min: the minimum acceptable value max: the maximum acceptable value precondition: user has been prompted for input errorMsg may be assigned a value, otherwise defaukt arguments are -DBL_MAX and DBL_MAX uses headwr files: iostream, string, limits, cctype postcondition: a valid double in the range min to max is returned double readDouble(string errorMsg, double min, double max) double someDouble; bool valid = false; //stores each double entered //loop control flag indicating validity of entry // initially assume not valid / read a double delimited by a whitespace character cin >> someDouble; // valid if within min to max range; valid = someDouble >= min && someDouble :: max(), ' '); valid = false; // no valid entry has been read } while (!valid); // while not valid continue executing do while loop // when valid input received, remove from input stream up to 100 remaining // characters or until reaches the ' ' character cin.ignore(100, ' '); return someDouble; environment // return a valid double to calling Scanned with CamScanner Page 2 of 2 The main function should repeatedly call the following two functions, allowing entry of multiple sets of data using an event controlled loop that asks the user to give a yes or no answer as to whether or not they would like to enter a set of student test scores for averaging. Call your readChar function to get user's response. 5. getStudentAverage function Code a void function that uses two reference parameters to return a name of type string& and an average of type double& to the calling environment. This function will: - Prompt for and get the student's name by calling the string class getline function. - Prompt for and get the four test scores for the student by calling the readint function for each test score and storing each in a local variable - will need four local variables. A valid - test score will be in the range 0 to 100. - Pass the four test scores to the min function to find and return the minimum score. - Calculate the total of the highest three test scores. - Call the average function to calculate the average of those three scores. - Return the student's name and the test average to the calling environment (main in this case). 6. displayStudentAverage function Code a void function to display information to the screen. This function should receive as value parameters the student's name and average and display those values to the screen along with identifying text. Display the average with one decimal digit of precision. Run an adequate set of test data and have another student examine your program prior to demonstrating to instructor and submitting for grading. Don't forget to submit the Hierarchy Chart! Scanned with CamScanner COSC 1336, M8e PA5-Drop Lowest Score Sequence, Selection, Logical and Relational Operations (Chap 4), Iteration (Chap 5), String class Processing (Chap 3), Reference Parameters (Chap 6) and Program Abstraction s the Write an iterative program that calculates the average of a group of test scores for a class of student lowest score in the group is dropped from the calculation. First, read through the entire assignment and develop a HIERARCHY CHART of the function calls and the data that will be passed between them. Submit this chart for grading. This may be hand drawn and submitted on power. Create a new programming project and add your library files to it. Next code the following two functions as described below. Apply bottom-up design coding main driver routings for testing each of the following functions. Comment out and keep the driver test code and results for later review. 1. average function Code a generic, reusable value returning function of type double that has two value parameters; a double for the sum total of the values to average and an integer for the count of number of values to be averaged. The function will calculate and return a floating-point average as a double. Check for invalid division by zero. If a valid average cannot be calculated, the function should return 0.0. When fully implemented and tested, move to your library files. 2. min function Code a generic, reusable value returning function of type int that has four value parameters to receive four integers. The function will use IF selection statements and the logical operators (AND) && and/or (OR) II, and relational operators (, >=) to find and return the lowest of four integer values received. (Do NOT code to use an array structure or code without using either the && or II operators!) When fully implemented and tested, move to your library files. - TEST THOROUGHLY!!! Include test sets with values in ascending, descending and mixed orders and a set with all values the same amount. When fully implemented and tested move to your library files. - TEST THOROUGHLY and keep test code. 4. main function Code a main function with the following user interface according to the specification given below: Program Calculates the average of 4 Tests after Dropping the Lowest Score. Would you like to find a student's average? (Y or N): Y Enter students name: John Doe Enter Test 1 Score: 99 Enter Test 2 Score: 97 Enter Test 3 Score: 100 Enter Test 4 Score: 90 Students Name: John Doe Average calculated using three highest test scores: 98.7 Find another student's average? (Y or N): y 2/19/2020 Scanned with CamScanner

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!