0% found this document useful (0 votes)
18 views1 page

Grade Calculator

The document is a Java program that calculates a student's grade based on their score input. It uses conditional statements to determine the grade, which ranges from A to F. The program prompts the user for their score, evaluates it, and then prints the corresponding grade.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Grade Calculator

The document is a Java program that calculates a student's grade based on their score input. It uses conditional statements to determine the grade, which ranges from A to F. The program prompts the user for their score, evaluates it, and then prints the corresponding grade.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

assignment 1

import java.util.Scanner;

public class GradeCalculator {


public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

// Read the score


System.out.println("Enter your score:");
int score = scanner.nextInt();

// Determine the grade


String grade;
if (score >= 90 && score <= 100) {
grade = "A";
} else if (score >= 85 && score <= 89) {
grade = "A-";
} else if (score >= 70 && score <= 84) {
grade = "B";
} else if (score >= 57 && score <= 69) {
grade = "C";
} else if (score >= 50 && score <= 56) {
grade = "D";
} else {
grade = "F";
}

// Print the result


System.out.println("Your grade is " + grade);

scanner.close();
}
}

You might also like