Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- // Determine final class grade using formula:
- // Average the two tests and multiply by .4
- // Multiply the midterm and final by .3
- // Add these together for the final grade.
- int main()
- {
- float final_grade = 0;
- float test_1 = 0;
- float test_2 = 0;
- float midterm_exam = 0;
- float final_exam = 0;
- cout << "Enter grade for test 1: ";
- cin >> test_1;
- cout << "Enter grade for test 2: ";
- cin >> test_2;
- cout << "Enter grade for midterm exam: ";
- cin >> midterm_exam;
- cout << "Enter grade for final exam: ";
- cin >> final_exam;
- final_grade = (((test_1 + test_2) / 2) * 0.4) +
- (midterm_exam * 0.3) + (final_exam * 0.3);
- cout << "Your final grade is " << final_grade << '\n';
- return 0; // End the program.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement