Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* This program computes the final grade based off of the following weighted categories:
- 40% from 4 assignments
- 15% Midterm Exam
- 35% Final Exam
- 10% Participation */
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main () {
- //Declare variables, which are the categories.
- double assignment;
- double midterm;
- double final;
- double participation;
- double finalGrade;
- int sum;
- int i = 0;
- //Asking the user for 4 Assignment scores.
- while (i < 4) {
- cout << "Enter assignment score: ";
- cin >> assignment;
- cout << endl;
- sum += assignment;
- i++;
- }
- //Asking the user to input a midterm score, final score, and partcipation.
- cout << "Enter midterm score: ";
- cin >> midterm;
- cout << endl;
- cout << "Enter final score: ";
- cin >> final;
- cout << endl;
- cout << "Enter participation grade: ";
- cin >> participation;
- cout << endl;
- //Calculating the final grade.
- finalGrade = (0.4)*(sum/4) + (.15)*(midterm) + (.35)*(final) + (.10)*(participation);
- cout << "Final Grade: " << finalGrade << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment