I've written a program for averaging lists of exam grades before but throwing in a percentage is throwing me for a loop. I don't know how to handle this information. Any help will be greatly appreciated.
//Write a program that asks the user to enter a student's midterm
//and final exam scores. The program should display the midterm and
//final exam scores and the student's final grade. Compute the final
//grade by taking the sum of 40% of the midterm exam score and 60% of
//the final exam score.
//using namespace std;
double 40% mid;
cout<< set precision()
//obtain input data
//Do the calculations
final grade = double (midterm + final);
Hello Joanne, thanks for the question.
I don't know if you formatted the code like that to make it more readable, but a lot of your syntax is off. For one thing, a variable name cannot start with a number in C++. Perhaps you were overthinking this problem some, because it's really not that difficult. The following code should help point you in the right direction:
using namespace std;
float midterm, final, average;
cout << "Enter a midterm grade:";
cin >> midterm;
cout << "Enter a final grade:";
cin >> final;
average = (.4f * midterm) + (.6f * final);
cout << "The average is: " << average << '\n';
As you can see, it sums up the average correctly by adding 40 percent of the midterm with 60 percent of the final, as per the commented directions.
I hope this information was helpful.