-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #262 from VaibhavS0710/hack
Grade Calculator System
- Loading branch information
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import java.util.Scanner; | ||
|
||
public class GradeCalculator { | ||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
|
||
System.out.print("Maths: "); | ||
float maths = sc.nextFloat(); | ||
|
||
System.out.print("Physics: "); | ||
float physics = sc.nextFloat(); | ||
|
||
System.out.print("Chemistry: "); | ||
float chemistry = sc.nextFloat(); | ||
|
||
System.out.print("ComputerSc: "); | ||
float computerSc = sc.nextFloat(); | ||
|
||
System.out.print("Biology: "); | ||
float biology = sc.nextFloat(); | ||
|
||
System.out.print("Sum of the marks obtained: "); | ||
float sum = maths + physics + chemistry + computerSc + biology; | ||
System.out.println(sum); | ||
|
||
System.out.print("Average Percentage: "); | ||
float percentage = (sum / 500)*100; | ||
|
||
System.out.println(percentage + "%: "); | ||
|
||
System.out.println("Grade Distribution:"); | ||
System.out.println("91-100%: A+"); | ||
System.out.println("81-90%: A"); | ||
System.out.println("71-80%: B"); | ||
System.out.println("61-70%: C"); | ||
System.out.println("51-60%: D"); | ||
System.out.println("41-50%: E"); | ||
System.out.println("Less than 40%: F(Fail)"); | ||
|
||
System.out.print("Your grade is: "); | ||
if(percentage > 90){ | ||
System.out.println("A+"); | ||
} | ||
else if (percentage > 80) { | ||
System.out.println("A"); | ||
} | ||
else if(percentage > 70){ | ||
System.out.println("B"); | ||
} | ||
else if(percentage > 60){ | ||
System.out.println("C"); | ||
} | ||
else if(percentage > 50){ | ||
System.out.println("D"); | ||
} | ||
else if(percentage > 40){ | ||
System.out.println("E"); | ||
} | ||
else if(percentage < 40){ | ||
System.out.println("F"); | ||
} | ||
|
||
|
||
} | ||
} | ||
|
||
|