Answered You can hire a professional tutor to get the answer.

QUESTION

This is the question for my lab. Using the code below, complete the code and run the program. The following is the code to be used:

This is the question for my lab.

Using the code below, complete the code and run the program.

The following is the code to be used:

// This program will read in a group of test scores( positive integers from 1 to 100)

// from the keyboard and then calculates and outputs the average score

// as well as the highest and lowest score. There will be a maximum of 100 scores.

// PLACE YOUR NAME HERE

#include <iostream>

using namespace std;

// Function prototypes

float findAverage (const GradeType, int); // finds average of all grades

int  findHighest (const GradeType, int); // finds highest of all grades

int  findLowest (const GradeType, int); // finds lowest of all grades 

int main( void )

{

  int GradeAray[100]; + // an integer array of 100 elements

  int numberOfGrades; // the number of grades read.

  int pos;           // index to the array.

  float avgOfGrades;  // contains the average of the grades.

  int highestGrade;   // contains the highest grade.

  int lowestGrade;    // contains the lowest grade.

  // Read in the values into the array

pos = 0;

cout << "Please input a grade from 1 to 100, (or -99 to stop)" << endl;

cin >> GradeAray [pos];

while (GradeAray [pos] != -99)

{

// Fill in the code to read the grades

}

numberOfGrades = _________; // Fill blank with appropriate identifier hint: pos is last grade in

// call the function to find average      

avgOfGrades = findAverage(GradeAray, numberOfGrades);

cout << endl << "The average of all the grades is " << avgOfGrades << endl;

// Fill in the call to the function that calculates highest grade

cout << endl << "The highest grade is " << highestGrade << endl;

// Fill in the call to the function that calculates lowest grade

// Fill in code to write the lowest to the screen

return 0;

}

//***************************************************************************

//                                findAverage

// task:         This function receives an array of integers and its size.

//               It finds and returns the average of the numbers in the array

// data in:      array of floating point numbers

// data returned: average of the numbers in the array

//

//***************************************************************************

float findAverage (const GradeType array, int size)

{  

   float sum = 0;  // holds the sum of all the numbers

   for (int pos = 0; pos < size; pos++)

        sum = sum + array[pos];

   return (sum / size); //returns the average

}

//***************************************************************************

//                                findHighest

//         task:         This function receives an array of integers and its size.

//          It finds and returns the highest value of the numbers in the array

//         data in:      array of floating point numbers

//         data returned: highest value of the numbers in the array

//***************************************************************************

int  findHighest (const GradeAray, int size)

{

  // Fill in the code for this function

}

 //***************************************************************************

//                                findLowest

//         task:         This function receives an array of integers and its size.

//         It finds and returns the lowest value of the numbers in the array

//         data in:      array of floating point numbers

//         data returned: lowest value of the numbers in the array

//*************************************************************************** 

int  findLowest (const GradeAray, int size)

{

  // Fill in the code for this function

 }

This is my code. I'm not sure what other things I need to write but I feel like I'm doing wrong. Can someone explain to me for this lab to me step by step??

#include <iostream>

#include <iomanip>

using namespace std;

const int MAXGRADE = 25;

const int MAXCHAR = 30; 

typedef char StringType30 [MAXCHAR + 1];

typedef float GradeType[MAXGRADE];

float findGradeAvg(GradeType, int);

char findLetterGrade(float);

int main ( void )

{

  stringType30 firstname, lastname;

  int numofGrades;

  GradeType grades;

  float average;

  char moreinput;

  cout << "Please input the number of grades each student will receive." << endl

  cout << "This number must be a number between 1 and " << MAXGRADE << " include" << endl

  cin >> numofGrades;

  while (numofGrades > MAXGRADE || numofGrades < 1)

  {

    cout << "Please input the number of grades for each student." << endl

       << "This number must be a number between 1 and " << MAXGRADE << "include" << endl

    cin >> numofGrades 

  }

}

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question