Question

In: Computer Science

Write a C++ program that reads a students name followed by 7 numeric grades from a...

Write a C++ program that reads a students name followed by 7 numeric grades from a file.  Compute the average grade after dropping the  lowest grade.   Assign letter grades via this scale .Please show steps in the comments .

A 90 – 100

B 80  --89

C 70 –79

D 60 -69

F 0  - 59

Input format:

Sam 100 90 87 23 12 67 95

Mary 30 20 90 90 90 90 88

Mark 80 90 80 80 90 87 100

End of file

                                                              REPORT

   Name                                                                                             Grade

      Sam                                                                                                 C

      Mary                                                                                                A

       Mark                                                                                               B

The student with the highest average is   Mary   (99.99)

The student with the lowest average is     Sam    (99.99)

Solutions

Expert Solution

C++ program to find average, total and grade

Steps:

  • Enter the numbers of students detail like to enter
  • Collect the seven subject marks
  • Find total, average and grade

Source code

#include<iostream> 
 #include<conio.h> 
 using namespace std;
 int main ( ) 
 {   
     // define struct and decide the number of subjects
             struct student 
          { 
               int subject1 ; 
               int subject2 ; 
               int subject3 ; 
               int subject4 ;
               int subject5 ;
               int subject6 ;
               int subject7 ;
               
          }; 
        // define number of students markes have to be collected
                int i , n, total; 
                float av ; 
                 
                struct student st[20]; 
                char name[20];
                cout<<" \n Enter the Number of Students marks wish to enter : " ; 
                cin>> n ; 
                for (i =0; i<n; i++) 
                    { 
                        // Collecting the basic details
                        cout<<"Enter the name of Student: ";
                        cin>>name;
                           cout<<"\nEnter the Marks of seven Subjects : " ; 
                           total = 0 ; 
                           cin>> st[i].subject1 >>st[i].subject2>>st[i].subject3>>st[i].subject4>>st[i].subject5>>st[i].subject6>>st[i].subject7; 
                           total = st[i].subject1+st[i].subject2+st[i].subject3+st[i].subject4+st[i].subject5+st[i].subject6+st[i].subject7; 
                           av = (float) total /7 ; 
                           cout<<"Total mark is :"<<total;
                           cout<<"\nAVERAGE Marks of  the Student is : "<< av ; 
                           cout<<"\nYour Grade is :: ";
                         
                          // define the conditions of grade
        if(av>89)
        {
                cout<<"[ A ]\n";
        }
        else if(av>79 && av<=89)
        {
                cout<<"[ B ]\n";
        }
        else if(av>69 && av<=79)
        {
                cout<<"[ C ]\n";
        }
        else if(av>59 && av<=69)
        {
                cout<<"[ D ]\n";
        }
        else
        {
            cout<<"[ F ]\n";
        }
        
                     } 
                           
                           return 0;
 }

The output:


Related Solutions

C++ Description: You will write a program that reads students names followed by their final grade....
C++ Description: You will write a program that reads students names followed by their final grade. It will output the names and their grade, followed by the corresponding letter grade. It will also print the name of the students(s) with the highest grade Student data will be stored in a struct called studentType which has 4 members: fName lName score letterGrade Assume there are 20 students Your main() function will only have variable definitions and function calls You MUST have...
using c++. ALWAYS GRADE MY ANSWERS Write a program that reads students’ names followed by their...
using c++. ALWAYS GRADE MY ANSWERS Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type studentType, which has four components: studentFName and studentLName of type string, testScore of type...
Write a program that reads students’ names followed by their test scores. The program should output...
Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type studentType, which has four components: studentFName and studentLName of type string, testScore of type int (testScore is between 0 and...
In java Q2. Write a program that reads grades of type double of eight students that...
In java Q2. Write a program that reads grades of type double of eight students that the user provides. The grades lie between 0 and 10. These grades should be written to a binary file and read from it. The program outputs the highest and lowest grades achieved by students on the screen. The file contains nothing but numbers of type double written to the file with writeDouble.
C++ Write a program that prompts for a file name and then reads the file to...
C++ Write a program that prompts for a file name and then reads the file to check for balanced curly braces, {; parentheses, (); and square brackets, []. Use a stack to store the most recent unmatched left symbol. The program should ignore any character that is not a parenthesis, curly brace, or square bracket. Note that proper nesting is required. For instance, [a(b]c) is invalid. Display the line number the error occurred on. These are a few of the...
Write a program that reads a student's code and grades from all four tests of any...
Write a program that reads a student's code and grades from all four tests of any matter; and calculate and print the final grade for the subject, along with the student code. Taking into account that: The value of the first is 15% The value of the second is 25% The value of the third is 30% The value of the fourth is 40% Programming language is VB8
Write a C++ program that reads a file consisting of students’ test scores in the range...
Write a C++ program that reads a file consisting of students’ test scores in the range 0–200. It should then determine the number of students having scores in each of the following ranges: 0–24, 25–49, 50–74, 75–99, 100–124, 125–149, 150–174, and 175–200. Output the score ranges and the number of students. (Run your program with the following input data: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176,...
In C++ Design and implement a program (name it ProcessGrades) that reads from the user four...
In C++ Design and implement a program (name it ProcessGrades) that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below.
In C++, write a program that reads data from a text file. Include in this program...
In C++, write a program that reads data from a text file. Include in this program functions that calculate the mean and the standard deviation. Make sure that the only global variables are the actual data points, the mean, the standard deviation, and the number of data entered. All other variables must be local to the function. At the top of the program make sure you use functional prototypes instead of writing each function before the main function... ALL LINES...
Write a Java program that reads a name and displays on the screen.
Write a Java program that reads a name and displays on the screen.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT