Java Lesson 2: If‑Statements &s; Decisions

Teach your program to choose different paths using conditions.

🎯 Learning Goals

Extract my java code below and insert into Eclipse. Modify code to include the message below.

🟦 Example 1: Grade Decider

Reads a numeric score and prints a letter grade with simple thresholds.

import java.util.Scanner;


public class GradeDecider {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter score (0-100): ");
int score = in.nextInt();

if (score >= 90) {
System.out.println("A");
} else if (score >= 80) {
System.out.println("B");
} else if (score >= 70) {
System.out.println("C");
} else if (score >= 60) {
System.out.println("D");
} else {
System.out.println("F");
}
in.close();
}
}
Try it: Add a message like “Great job!” for A or B, and “Keep going!” otherwise.
The name of the file will be: PX_GradeDecider_lastname

Files to save in your google drive under your class name
and to Submit to (Google Classroom)