Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CIS 22A < < < < > size; // Get each test score. for(index = 1; index > scores[index]; } } //**************************************************** // The getTotal

CIS 22A<<<<s.

#include

#include using namespace std;

// Function prototypes void getTestScores(double scores[], int size); double getTotal(const double array, int size); double getLowest(const double array, int &size);

int main() { const int SIZE = 45; // Array maximum size int size; // Array actual size double testScores[SIZE], // Array of test scores total, // Total of the scores lowestScore, // Lowest test score average; // Average test score

// Get the test scores from the user. getTestScores(testScores[], size);

// Get the total of the test scores. total = getTotal(testScores[], size

// Get the lowest test score. lowestScore = getLowest(testScores[], size);

// Subtract the lowest score from the total. total -= lowestScore;

// Calculate the average. Divide by 3 because // the lowest test score was dropped. average = total / size;

// Set up numeric output formatting. cout << fixed << showpoint << setprecision(1); // Display the average. cout << "The lowest score is " << lowestScore << ". "; cout << "The average with the lowest score " << "dropped is " << average << ". ";

return 0; }

//************************************************************ // The getTestScores function accepts an array and its size * // as arguments. It prompts the user to enter test scores, * // which are stored in the array. * //************************************************************ void getTestScores(double scores[], int &size) { // Loop counter int index; // Get the number of scores cout << "Enter the number of scores "; cin >> size; // Get each test score. for(index = 1; index <= size; index++) { cout << "Enter test score number " << index << ": "; cin >> scores[index]; } }

//**************************************************** // The getTotal function accepts a double array * // and its size as arguments. The sum of the array's * // elements is returned as a double. * //****************************************************

double getTotal(const double array[], int size) { double total = 0; // Accumulator

// Add each element to total. for (int count = 0; count < size; count + 1) total += array[count];

// Return the total. return total; }

//**************************************************** // The getLowest function accepts a double array and * // its size as arguments. The lowest value in the * // array is returned as a double. * //****************************************************

double getLowest(const double array[], int size) { double lowest; // To hold the lowest value

// Get the first array's first element. lowest = array[0];

// Step through the rest of the array. When a // value less than lowest is found, assign it // to lowest. for (int count = 1; count < size; count++) { if (array[count] < lowest) lowest = array[count]; }

// Return the lowest value. return array[lowest]; }

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

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago