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

My instructor needs me to write a program to compute the minimum grade that a st

ID: 3631895 • Letter: M

Question

My instructor needs me to write a program to compute the minimum grade that a student must make on the final exam to make as specific grade in his class. To compute the semester average, the average of the three six-week grades will count 80% and the final exam will count 20%. A text file named: data.txt will have the first line of input containing a single integer n that indicates the number of students in his class. Each of the following n lines will contain a student’s sixdigit ID number, three six-week’s grades and the semester average the student wishes to have. Each of the items will be separated by a space. You will print the student’s ID number, a space, and the minimum grade the student can make to achieve the desired average. To keep the student from having false expectations, the minimum grade should be rounded up to the nearest integer. For example, 87.2 would become an 88. Do not round any computation except the final minimum grade, which will be the smallest integer that is greater than or equal to the grade needed to obtain the desired grade.

#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
using namespace std;
int main()
{
ifstream inFile;
int stuNo, number;
int value1, value2, value3, value4, min;
double desired, average;
string filename;
cout << "Enter the file name: ";
cin >> filename;
inFile.open(filename.c_str());
if (inFile)
{
inFile >> number;
for (int count = 1; count <= number; count++)
{
cout << stuNo << " needs a " << min << " to earn a " << desired << " " << endl;
}
inFile.close();
}
else
{
cout << "Error opening the file. ";
}
system("pause");
return 0;
}

Explanation / Answer

please rate - thanks

did some searching, found a formula

#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
using namespace std;
int main()
{
ifstream inFile;
int stuNo, number;
int value1, value2, value3, value4, min;
double has,desired,needs, average;
string filename;
cout << "Enter the file name: ";
cin >> filename;
inFile.open(filename.c_str());
if (inFile)
{
inFile >> number;
for (int count = 1; count <= number; count++)
{inFile>>stuNo>>value1>>value2>>value3>>desired;
average=(value1+value2+value3)/3.*.8; //average so far
min=(int)((desired-average)/.2+.5);
cout << stuNo << " needs a " << min << " to earn a " << desired << " " << endl;
}
inFile.close();
}
else
{
cout << "Error opening the file. ";
}
system("pause");
return 0;
}

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