Guest User

Untitled

a guest
Oct 18th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. /* This program computes the final grade based off of the following weighted categories:
  2. 40% from 4 assignments
  3. 15% Midterm Exam
  4. 35% Final Exam
  5. 10% Participation */
  6.  
  7. #include <iostream>
  8. #include <cmath>
  9. using namespace std;
  10.  
  11. int main () {
  12.  
  13. //Declare variables, which are the categories.
  14. double assignment;
  15. double midterm;
  16. double final;
  17. double participation;
  18. double finalGrade;
  19.  
  20. int sum;
  21. int i = 0;
  22.  
  23. //Asking the user for 4 Assignment scores.
  24. while (i < 4) {
  25. cout << "Enter assignment score: ";
  26. cin >> assignment;
  27. cout << endl;
  28. sum += assignment;
  29. i++;
  30. }
  31.  
  32. //Asking the user to input a midterm score, final score, and partcipation.
  33. cout << "Enter midterm score: ";
  34. cin >> midterm;
  35. cout << endl;
  36.  
  37. cout << "Enter final score: ";
  38. cin >> final;
  39. cout << endl;
  40.  
  41. cout << "Enter participation grade: ";
  42. cin >> participation;
  43. cout << endl;
  44.  
  45. //Calculating the final grade.
  46. finalGrade = (0.4)*(sum/4) + (.15)*(midterm) + (.35)*(final) + (.10)*(participation);
  47.  
  48. cout << "Final Grade: " << finalGrade << endl;
  49.  
  50.  
  51. return 0;
  52. }
Add Comment
Please, Sign In to add comment