repl.it
@sthomason1/

Letter grade converter

Java

Converts a score in percentage to a letter grade

fork
loading
Files
  • Main.java
  • jdt.ls-java-project
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import java.util.Scanner;

class Main {
  public static void main (String[] args) {
    Scanner scnr = new Scanner(System.in);
    System.out.println("Enter your test score, out of 100");
    double score = scnr.nextDouble();
    if (59.5>score) {
      System.out.println("Your grade is an F... :(");
    } else if (69.5>score) {
      System.out.println("Your grade is a D");      
    } else if (79.5>score) {
      System.out.println("Your grade is a C");
    } else if (89.5>score) {
      System.out.println("Your grade is a B");
    } else {
      System.out.println("Your grade is an A!");
    }
  }
}
Fetching token
?