Skip to content

Commit

Permalink
Merge pull request #262 from VaibhavS0710/hack
Browse files Browse the repository at this point in the history
Grade Calculator System
  • Loading branch information
BlackIQ authored Oct 23, 2024
2 parents b2be38b + 74e779f commit b36a430
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions Java/examples/GradeCalculator.java
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");
}


}
}


0 comments on commit b36a430

Please sign in to comment.