1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
nevsk [136]
2 years ago
10

Write a C++ program that manage the student’s grades. Starting with a fixed number of students (use 10 for simplicity) the user

will input the grades for each student. The number of grades is given by the user. The grades are stored in an array. Two functions are called for each student. One function will give the numeric average of their grades. The other function will give a letter grade to that average. Grades are assigned on a 10-point spread. 90-100 A 80- 89 B 70-79 C 60-69 D Below 60 F
Computers and Technology
1 answer:
BigorU [14]2 years ago
5 0

Answer:

#include <iostream>

using namespace std;

float findAverage(double grades[], int numOfgrades) {

   float sum = 0;

   for ( int i = 0 ; i < numOfgrades; i++ ) {

       sum += grades[i];

   }

   return (sum / numOfgrades);

}

char findLetterGrade(double grades[], int numOfgrades) {

   char letter;

   if(findAverage(grades, numOfgrades) >= 90 && findAverage(grades, numOfgrades) <= 100)

       letter = 'A';

   else if(findAverage(grades, numOfgrades) >= 80 && findAverage(grades, numOfgrades) <= 89)

       letter = 'B';

   else if(findAverage(grades, numOfgrades) >= 70 && findAverage(grades, numOfgrades) <= 79)

       letter = 'C';

   else if(findAverage(grades, numOfgrades) >= 60 && findAverage(grades, numOfgrades) <= 69)

       letter = 'D';

   else if(findAverage(grades, numOfgrades) >= 0 && findAverage(grades, numOfgrades) <= 59)

       letter = 'F';

       

   return letter;

}

int main()

{

   int numOfgrades, grade;

   

   for (int i = 0; i < 10; i++) {

       cout<<"Enter the number of grades for student #" << i+1 <<": ";

       cin >> numOfgrades;

       double grades[numOfgrades];

       

       for (int j = 0; j < numOfgrades; j++) {

           cout<<"Enter the grade" << j+1 <<" for student #" << i+1 <<": ";

           cin >> grade;

           grades[j] = grade;

       }

       cout << "Student #" << i+1 << " got " << findLetterGrade(grades, numOfgrades) << endl;

   }

   

   return 0;

}

Explanation:

Create a function named findAverage that takes two parameters, grades array and numOfgrades

Inside the function, create a for loop that iterates through the grades and calculates the sum of the grades. Then, return the average, sum/numOfgrades

Create another function named findLetterGrade that takes two parameters, grades array and numOfgrades

Inside the function, check the average grade by calling the findAverage() function. Set the letter grade using the given ranges. For example, if the result returned from findAverage() function is between 80 and 89, set the letter to 'B'. Then, return the letter.

In the main:

Create a for loop that iterates for each student, in this case 10 students. Inside the loop:

Ask the user to enter the number of grades for student. Using this value, create a grades array.

Create another for loop (inner for loop) that will set the grades array using the values entered by the user.

When the inner loop is done, call the findLetterGrade() function passing the grades array and numOfgrades as parameter and print the result

You might be interested in
What are the basic tools for coding HTML manually?
Dimas [21]
The answer should be C, you need a text editor to write out the code, and then a web browser to view what the code creates.
8 0
2 years ago
Read 2 more answers
1. Briefly explain the concept of signature of a function, in a function declaration. What signature components are crucial for
Irina18 [472]

Answer:

Function signature can be defined as a combined term used to refer to the function name, function return type, no of arguments , type of arguments.

Explanation:

The signature of function is seen as a combined term used to refer to the function name, function return type, number of arguments , type of arguments.

When overloaded functions is been defined, they are different in numbet of arguments or type of argument passed.

To understand this better refer to the program code below.

C++ code.

#include <iostream>

using namespace std;

int multiply(int a, int b)

{

cout << a*b <<endl;

return 0;

}

int multiply(int a, int b, int c)

{

cout << a*b*c <<endl;

return 0;

}

int main()

{

//function with two arguments passed

multiply(3, 50);

//function with three arguments passed . It is different in number of arguments passed. Thus here function signature is different

multiply(4, 20, 10);

}

6 0
2 years ago
A search engine displays a list of webpage names that contain the search text. what is the term for that list?
Minchanka [31]
<span>A search engine displays a list of webpage names that contain the search text. The term for that list is hit.
Basically, what this term refers to is the number of visits, or a number of downloads that happened on that particular webpage. It is a good tool to measure web traffic, or how much that page is visited.
</span>
6 0
3 years ago
What is BINARY it is making get confused
enot [183]
It is a number that is expressed in the binary numerical system
6 0
3 years ago
Decimal numbers are based on __________.
MaRussiya [10]
They are based on 10 digits.

I’m not sure.
8 0
3 years ago
Read 2 more answers
Other questions:
  • How much does a Canon PowerShot G7X cost in America?
    14·1 answer
  • 2. What are the pros and cons of Toyota structure?
    13·1 answer
  • The Internet and World Wide Web allow almost any business to be global. What are two important results of this process?
    8·1 answer
  • Digital libraries are often available to students and/or employees at colleges, schools, and BLANK institutions.
    15·1 answer
  • How does emotional awareness help you with non-verbal communication?
    13·2 answers
  • Which elements are in the Sort dialog box? Check all that apply.
    9·1 answer
  • Assume that a 5 element array of type string named boroughs has been declared and initialized. Write the code necessary to switc
    5·1 answer
  • Which do switches create?<br> Networks<br> Wireless access points<br> Routes<br> Collision domains
    13·1 answer
  • A program is run line by line to determine the source of a logic error. Which best describes the specific tool being used?
    11·2 answers
  • What is phishing?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!