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

c++ You have become fed up with waiting for Prof. Keeling to calculate your fina

ID: 3743134 • Letter: C

Question

c++

You have become fed up with waiting for Prof. Keeling to calculate your final grade. You have decided that to lower your frustrations and write a program to calculate your final grade and the grades of 5 of your classmates.

Use the structure chart below to guide the design of your program.

Create a file named "infile.txt" with data for you and your classmates. An easy way to create this file is to copy and paste the data below into a text file.

DO NOT INCLUDE THE HEADING IN YOUR INPUT FILE

For each student the main function calls each of the "compute" functions. These functions call the appropriate "get" function that uses the globally declared input file to read the individual scores from the file, adds them together and returns the total score for each assessment category (assignments, lab, quizes and exams). Use the following requirements to compute the grades (characters) that are to be returned to the main() function by each of the "compute" functions.

Use the weighted computations described below to compute the Final Grade (A - F) for each student.

Finally, in main print a report showing each student's Identifier (Student X) where X goes from 1 to 6. The report should show each component of the student's grade (lab, assignment, quiz and test letter grade) and each student's final letter grade.

Your can declare the input file as a global variable.



Your output should look like the screen below:

Use the following code to get started:

When you are finished, copy and paste your output to the end of your source code as a comment. Re-compile this commented code to make sure that your have not introduced any new errors.

Main assignment_grade lab grade quiz grade test l grade Compute lab Compute_quiz Computetest Compute assignment grade grade grade grade labscore uiz score test score assignment score Get lab data Get quiz data Get test data Get assignment data

Explanation / Answer

ScreenShot

Program

//Header files
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
//Function Prototypes (structure chart functions)
int Get_lab_data();
int Get_quiz_data();
int Get_test_data();
int Get_assignment_data();
char Compute_lab_grade();
char Compute_quiz_grade();
char Compute_test_grade();
char Compute_assignment_grade();
char final_grade();
// global file variable
ifstream myfile;
int total = 0;
int main()
{
  
   //Openfile
   myfile.open("C:/Users/deept/Desktop/infile.txt");
   //Check it can open
   if (!myfile) {
       cout << "File cannot be open!!" << endl;
       exit(0);
   }
   else {
       //Display 6 students details
       for (int i = 0; i < 6; i++) {
      
           cout << "Student " << i+1 << endl;
           cout <<"Student's Lab grade is: "<< Compute_lab_grade() << endl;
           cout << "Student's Assignment grade is: "<<Compute_assignment_grade() << endl;
           cout <<"Student's Quiz grade is: "<<Compute_quiz_grade() << endl;
           cout << "Student's Test grade is: "<<Compute_test_grade() << endl;
           cout << "Student's Final grade is: " <<final_grade()<< endl;
           cout << endl;
          
       }
      
   }
return 0;
}

//Lab data
int Get_lab_data() {
   int lab1, lab2, lab3, lab4, lab5;
   myfile >> lab1 >> lab2 >> lab3 >> lab4 >> lab5;
   return (lab1 + lab2 + lab3 + lab4 + lab5);
}
//Quiz total
int Get_quiz_data() {
   int qz1, qz2, qz3, qz4, qz5, qz6, qz7, qz8, qz9, qz10, qz11, qz12;
   myfile >> qz1 >> qz2 >> qz3 >> qz4 >> qz5 >> qz6 >> qz7 >> qz8 >> qz9 >> qz10 >> qz11 >> qz12;
   return (qz1+qz2+qz3+qz4+qz5+qz6+qz7+qz8+qz9+qz10+qz11+qz12);
}
//Test total
int Get_test_data() {
   int test1, test2,test3;
   myfile >> test1>>test2>>test3;
   return (test1 + test2+test3);
}
//Assignment total
int Get_assignment_data() {
   int assign1, assign2, assign3, assign4, assign5, assign6, assign7;
   myfile >> assign1 >> assign2 >> assign3 >> assign4 >> assign5 >> assign6 >> assign7;
   return   (assign1 + assign2 + assign3 + assign4 + assign5 + assign6 + assign7);
}
//Letter grade of lab data
char Compute_lab_grade() {
   int grade = Get_lab_data();
   total = 30 * grade;
   if (grade > 60) {
       return 'A';
   }
   else if (grade <= 60 && grade >= 50) {
       return 'B';
   }
   else if (grade <= 49 && grade >= 40) {
       return 'C';
   }
   else if (grade <= 39 && grade >= 30) {
       return 'D';
   }
   else if (grade <30 ) {
       return 'F';
   }
}
//Letter grade of quiz data
char Compute_quiz_grade() {
   int grade = Get_quiz_data();
   total += 10 * grade;
   if (grade > 100) {
       return 'A';
   }
   else if (grade <= 100 && grade >= 85) {
       return 'B';
   }
   else if (grade <= 84 && grade >=70) {
       return 'C';
   }
   else if (grade <= 69 && grade >= 60) {
       return 'D';
   }
   else if (grade <60) {
       return 'F';
   }
}
//Letter grade of test data
char Compute_test_grade() {
   int grade = Get_test_data();
   total += 35 * grade;
   if (grade > 360) {
       return 'A';
   }
   else if (grade <= 360 && grade >= 210) {
       return 'B';
   }
   else if (grade <=209 && grade >= 180) {
       return 'C';
   }
   else if (grade <= 179 && grade >= 150) {
       return 'D';
   }
   else if (grade <150) {
       return 'F';
   }
}
////Letter grade of assignment data
char Compute_assignment_grade() {
   int grade = Get_assignment_data();
   total += 25 * grade;
   if (grade > 130) {
       return 'A';
   }
   else if (grade <= 130 && grade >= 112) {
       return 'B';
   }
   else if (grade <= 111 && grade >= 100) {
       return 'C';
   }
   else if (grade <= 99 && grade >= 80) {
       return 'D';
   }
   else if (grade <80) {
       return 'F';
   }
}
//Final grade
char final_grade() {
   if ((total/100) > 3.49) {
       total = 0;
       return 'A';
   }
   else if ((total / 100) <= 3.48 && (total / 100) >= 2.7) {
       total = 0;
       return 'B';
   }
   else if ((total / 100) <= 2.69 && (total / 100) >= 1.7) {
       total = 0;
       return 'C';
   }
   else if ((total / 100) <= 1.69 && (total / 100) >= 0.7) {
       total = 0;
       return 'D';
   }
   else if ((total / 100) <0.7) {
       total = 0;
       return 'F';
   }
}

Output

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