-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblemE2.cpp
More file actions
69 lines (58 loc) · 1.65 KB
/
Copy pathProblemE2.cpp
File metadata and controls
69 lines (58 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
Jingi Min
CIS 22A 2023 Fall
Laboratory Assignment E
ProblemE1
get various values of a,b and c and find solution of equation
*/
#include <iostream>
using namespace std;
int main(){
int score1, score2, score3;
int numAssignmet, totalAssignment;
double average, percentAssignment;
cout << "Enter three tests scores (out of 100): ";
cin >> score1 >> score2 >> score3;
average = (score1 + score2 + score3) / 3.0;
if(average >= 90){
cout << "Grade is A" << endl;
}
else if(average >= 80){
cout << "Grade is B" << endl;
}
else if(average >= 70){
cout << "Grade is C" << endl;
}
else if(average >= 60){
cout << "Enter numbr of homework assignments the student turned in: ";
cin >> numAssignmet;
cout << "Enter total number of homework assignemnts: ";
cin >> totalAssignment;
percentAssignment = (static_cast<double>(numAssignmet) / (totalAssignment)) * 100;
if(percentAssignment > 80){
cout << "Grade is D" << endl;
}
else{
cout << "Grade is F" << endl;
}
}
else{
cout << "Grade is F" << endl;
}
return 0;
}
/*
Execution results
Enter three tests scores (out of 100): 96 84 90
Grade is A
Enter three tests scores (out of 100): 95 83 90
Grade is B
Enter three tests scores (out of 100): 70 59 60
Enter numbr of homework assignments the student turned in: 5
Enter total number of homework assignemnts: 6
Grade is D
Enter three tests scores (out of 100): 73 58 65
Enter numbr of homework assignments the student turned in: 8
Enter total number of homework assignemnts: 11
Grade is F
*/