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
5. ADD A STATEMENT OR STATEMENTS to the program on the following page (including constant and/or variable declarations if you wa
kvasek [131]

Answer:

C code is explained below

Explanation:

#include <stdio.h>

int main() { /* main */

/*

      **********************************************************

      * Declaration Section

      **********************************************************

      *

      * Named Constants

      */

  const int bits_per_byte = 8;

  const int attention_span_in_seconds = 3;

  /*

  * You can insert stuff after this comment.

*/

/*

* Local variables

*/

  int modem_send_speed_in_bits_per_second = 56000;

  int script_file_length_in_bytes = 28000;

  int seconds_to_send_script_file;

  /*

  * You can insert stuff after this comment.

*/

/*

      **********************************************************

      * Execution Section

      **********************************************************

      *

      * You can insert stuff after this comment.

*/

  seconds_to_send_script_file =

      (script_file_length_in_bytes * bits_per_byte) /

      modem_send_speed_in_bits_per_second;

  if (attention_span_in_seconds < seconds_to_send_script_file)

      printf("1\n");

  else printf("0\n");

} /* main */

4 0
3 years ago
If you want to copy data from one cel to another cell that is several rows down in a worksheet, which method should you use?
bogdanovich [222]

copy and paste

so you can keep the data in the current cell and add it to other cells that you want that data in as well

5 0
3 years ago
The second letter of the Koeppen letter code gives information about:
lukranit [14]

Answer:

a. the precipitation characteristics of the climate subtype.

Explanation:

The second letter in the code represents the detailed seasonality of precipitation, it shows when during the seasons precipitation comes to that climate.

6 0
3 years ago
Develop the truth table for each of the combinational logic circuits
Fudgin [204]

Answer:

ang haba po grabe hahahhaahhahahahahah

Explanation:

pabrainlest po t.y

3 0
2 years ago
To store non-duplicated objects in the order in which they are inserted, use:______
Umnica [9.8K]

Answer:

b. LinkedHashSet

Explanation:

A LinkedHashSet is an ordered version of HashSet that maintains a doubly-linked List across all elements. When the iteration order is needed to be maintained this class is used. LinkedHashSet maintains a linked list of the entries in the set, in the order in which they were inserted.

4 0
3 years ago
Other questions:
  • When are numbered lists generally used?
    14·2 answers
  • Write a class named Averager containing: An instance variable named sum of type integer, initialized to 0. An instance variable
    6·1 answer
  • Which of the following sentences uses the correct verb tense?
    8·2 answers
  • To arrange data in alphabetical order quickly, you can _____ the data.
    7·2 answers
  • Lydia used software to calculate the budget for each department. To create this budget, she used a _____.
    7·2 answers
  • Lux Ladies, Inc., is a company that specializes in expensive and unusual gifts for all occasions. It keeps a large file of infor
    11·1 answer
  • What can be designed to create annoying glitches or destroy data
    15·2 answers
  • . Write a swift programming code to perform following tasks a) Declare a variable that stores the age of a person b) Declare a c
    5·1 answer
  • The cutting tool that has a zig zag edge is called a?
    9·1 answer
  • Firewalls are available as a special hardware device or as software. A firewall will block packets of information that are from
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!