Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
java-learning
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Waqas Riaz
java-learning
Commits
166b432f
Commit
166b432f
authored
May 26, 2023
by
Waqas Riaz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated gradeLetter based on Average instead of percentage
parent
6f01f805
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
GradeCalculator.java
GradeCalculator/GradeCalculator.java
+6
-6
MainClass.java
GradeCalculator/MainClass.java
+2
-2
No files found.
GradeCalculator/GradeCalculator.java
View file @
166b432f
...
...
@@ -10,20 +10,20 @@ public class GradeCalculator{
}
public
static
String
getLetterGrade
(
double
percent
age
){
if
(
percent
age
<
60
){
public
static
String
getLetterGrade
(
double
aver
age
){
if
(
aver
age
<
60
){
return
"F"
;
}
else
if
(
percent
age
<=
69
){
else
if
(
aver
age
<=
69
){
return
"D"
;
}
else
if
(
percent
age
<=
79
){
else
if
(
aver
age
<=
79
){
return
"C"
;
}
else
if
(
percent
age
<=
89
){
else
if
(
aver
age
<=
89
){
return
"B"
;
}
else
if
(
percent
age
>=
90
){
else
if
(
aver
age
>=
90
){
return
"A"
;
}
...
...
GradeCalculator/MainClass.java
View file @
166b432f
...
...
@@ -8,7 +8,7 @@ public class MainClass{
int
size
=
5
;
int
[]
scores
=
new
int
[
size
];
for
(
int
i
=
0
;
i
<
size
;
i
++){
System
.
out
.
println
(
"Enter Score out of 10
for test number "
+
i
);
System
.
out
.
println
(
"Enter Score out of 10
0 for test number "
+
(
i
+
1
)
);
scores
[
i
]
=
inputObject
.
nextInt
();
// Read user input
}
...
...
@@ -18,7 +18,7 @@ public class MainClass{
double
average
=
GC
.
getAverageScore
(
scores
);
double
percentage
=
GC
.
getPercentageScore
(
scores
);
String
grade
=
GC
.
getLetterGrade
(
percent
age
);
String
grade
=
GC
.
getLetterGrade
(
aver
age
);
System
.
out
.
println
(
"Total Score is "
+
totalScore
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment