Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need a program for C++ that does the following i have the file to input the gr

ID: 3543705 • Letter: I

Question

I need a program for C++ that does the following i have the file to input the grades and all quiz scores, but i need the code:

The purpose of this assignment is to use functions to compute values needed for a grading program. We will also use input redirection to supply input for this program.

For this assignment, you are to write a program that will compute grades for a class of stu- dents. The input consists of the following information about each student:

<student id> <three test scores> <eight quiz scores> <final exam score>

The first line of input should consist of the student ID of 99999, followed by the maximum values that can be obtained for each test or quiz. Subsequent lines should consist of each student

I need a program for C++ that does the following i have the file to input the grades and all quiz scores, but i need the code: The purpose of this assignment is to use functions to compute values needed for a grading program. We will also use input redirection to supply input for this program. For this assignment, you are to write a program that will compute grades for a class of stu- dents. The input consists of the following information about each student: The first line of input should consist of the student ID of 99999, followed by the maximum values that can be obtained for each test or quiz. Subsequent lines should consist of each student's information, arranged in the order shown above. The last line should have a student ID of 0, indicating the end of the class list. You are to write two functions for this assignment. The first function will be called twice for each student - once to input test scores and compute the test average, and the second to input quiz scores and compute the quiz average. This function should have the following prototype: float calcavg (int num, int max); where num is the number of scores in the category and max is the maximum sum possible for that category. This function should input (ie., cin) num values, sum them and divide by max to determine the average of that category. The second function should return the letter grade ('A', 'B', etc.) for that student, based on the scale 90-100 is A, 80-90 is B, 70-80 is C, 60-70 is D, and below 60 is F. Its prototype should be: char dograde(float tpct, float tavg, float qpct, float qavg, float fpct, float fgrade); Where tpct, qpct and fpct are the percentages that each category is worth, and tavg, qavg and fgrade are the test average, quiz average and final test score, respectively. For this pro- gram, use percentages of 45% for tests, 30% for the quizzes and 25% for the final. where the ouput data should look something similar to this: Example Output

Explanation / Answer

#include <iostream>
#include <iomanip>

float calcavg (int num, int max);
float courseAvg(float tpct, float tavg, float qpct, float qavg,
                float fpct, float fgrade);
char dograde(float tpct, float tavg, float qpct, float qavg,
             float fpct, float fgrade);

int main()
{
    const int TEST_COUNT = 3;
    const int QUIZ_COUNT = 8;
    const float TEST_PCT = 0.45f;
    const float QUIZ_PCT = 0.30f;
    const float FINAL_PCT = 0.25f;
   
    int studentId;
    int score;
    int maxTestScore = 0;
    int maxQuizScore = 0;
    int maxFinalScore = 0;
    int totalTestScore;
    int totalQuizScore;
    int finalScore;
    float totalClassAvg = 0;
    int studentCount = 0;
   
    // Get maximum scores
    std::cin >> studentId;
    if (studentId == 99999) // valid first line
    {
        for (int i = 0; i < TEST_COUNT; ++i)
        {
            std::cin >> score;
            maxTestScore += score;
        }
        for (int i = 0; i < QUIZ_COUNT; ++i)
        {
            std::cin >> score;
            maxQuizScore += score;
        }
        std::cin >> maxFinalScore;
    }
    else                     // invalid first line id
    {
        std::cout << "Incorrect input format. Program aborted. ";
        return 1;
    }
   
    // Print headings
    std::cout << "                       Student Class List "
                 "Student    Test     Quiz   Final   Course Final "
                 " ID     Average Average Exam   Average Grade "
                 "_______ _______ _______ _____ _______ _____ ";
   
    // Read input line and print report line with proper format
    std::cout << std::fixed << std::setprecision(1);
    while (true)
    {
        std::cin >> studentId;
        if (!studentId) break; //if id == 0, stop reading input
       
        // increase studentCount
        ++studentCount;
        // reset previous scores...
        totalTestScore = totalQuizScore = finalScore = 0;
        // Read input scores
        for (int i = 0; i < TEST_COUNT; ++i) // 3 test scores
        {
            std::cin >> score;
            totalTestScore += score;
        }
        for (int i = 0; i < QUIZ_COUNT; ++i) // 8 test scores
        {
            std::cin >> score;
            totalQuizScore += score;
        }
        std::cin >> finalScore;               // final score
       
        // calculate test average
        float testAvg = calcavg(totalTestScore, maxTestScore);
        // calculate quiz average
        float quizAvg = calcavg(totalQuizScore, maxQuizScore);
        // calculate course average
        float studentAvg = courseAvg(testAvg, TEST_PCT, quizAvg, QUIZ_PCT,
                                     finalScore, FINAL_PCT);
        // add student avg to class avg
        totalClassAvg += studentAvg;
        // get letter grade
        char grade = dograde(testAvg, TEST_PCT, quizAvg, QUIZ_PCT,
                             finalScore, FINAL_PCT);
       
        // output with proper format
        std::cout << std::left << std::setw(7) << studentId << " "
                  << std::right
                  << std::setw(6) << testAvg << "   "
                  << std::setw(6) << quizAvg << "   "
                  << std::setw(3) << finalScore << "    "
                  << std::setw(6) << studentAvg << "   "
                  << std::setw(3) << grade << " ";
    }
    std::cout << " " << std::setw(30) << "Class Average"
                      << std::setw(10) << totalClassAvg/studentCount << " ";
   
    return 0;
}


float calcavg(int num, int max)
{
    return 100.0f * num / max ;
}

float courseAvg(float tpct, float tavg, float qpct, float qavg,
                float fpct, float fgrade)
{
    return tpct*tavg + qpct*qavg + fpct*fgrade;
}

char dograde(float tpct, float tavg, float qpct, float qavg,
             float fpct, float fgrade)
{
    float avg = courseAvg(tpct, tavg, qpct, qavg, fpct, fgrade);
    if (avg >= 90.0f) return 'A';
    if (avg >= 80.0f) return 'B';
    if (avg >= 70.0f) return 'C';
    if (avg >= 60.0f) return 'D';
    return 'F';
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote