Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. /* AnRan Lee (Aaron)
  2. CIS 71A - CIS 22A Winter 2018
  3. Laboratory Assignment D
  4. Problem D1
  5. This program finds momentum and kinetic energy with a mass and velocity.
  6. */
  7. #include <iostream>
  8.  
  9. using namespace std;
  10.  
  11. int main()
  12. {
  13. double testscoreA, testscoreB, testscoreC;
  14. double averagescore, homeworkdone, homeworktotal, homeworkaverage;
  15. cout << "Enter 3 test scores" << endl;
  16. cin >> testscoreA >> testscoreB >> testscoreC;
  17. averagescore= (testscoreA + testscoreB + testscoreC)/3;
  18.  
  19. if(averagescore>90.0){
  20. cout << "Your grade is A." <<endl;}
  21.  
  22. if(averagescore>80.0 && averagescore<90.0){
  23. cout << "Your grade is B." << endl;}
  24.  
  25. if(averagescore>70.0 && averagescore<80.0){
  26. cout << "Your grade is C." << endl;}
  27.  
  28. if(averagescore>60.0 && averagescore<70.0){
  29. cout << "Enter the number of assignments you turned in: " << endl;
  30. cin >> homeworkdone;
  31. cout << "Enter the total number of assignments: " << endl;
  32. cin >> homeworktotal;
  33. homeworkaverage=homeworkdone/homeworktotal;
  34. if(homeworkaverage>80.0){
  35. cout << "Your grade is D." << endl;}
  36. if(homeworkaverage<80.0){
  37. cout << "Your grade is F." << endl;}
  38. }
  39.  
  40. if(averagescore<60.0){
  41. cout << "Your grade is F." << endl;}
  42.  
  43.  
  44. return 0;
  45. }
  46. /* Execution Results:
  47. Enter 3 test scores
  48. 96
  49. 84
  50. 90
  51. Your grade is A.
  52.  
  53. Process returned 0 (0x0) execution time : 11.854 s
  54. Press any key to continue.
  55. Enter 3 test scores
  56. 95
  57. 83
  58. 90
  59. Your grade is B.
  60.  
  61. Enter 3 test scores
  62. 73
  63. 58
  64. 65
  65. Enter the number of assignments you turned in:
  66. 8
  67. Enter the total number of assignments:
  68. 11
  69. Your grade is F.
  70.  
  71. Process returned 0 (0x0) execution time : 12.502 s
  72. Press any key to continue.
  73.  
  74. Process returned 0 (0x0) execution time : 5.715 s
  75. Press any key to continue.
  76.  
  77. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement