019-001-002

Score Validation Program: Range Validation and Exception Handling

Medium

Problem Description

A program that validates whether a test score (0-100 points) is within the valid range and throws an exception if out of range. Using the same pattern as age validation, learn how to apply exception handling in a different domain (scores).

Test Cases

※ Output examples follow programming industry standards

Input:
80
Expected Output:
Valid Score
Input:
55
Expected Output:
Valid Score
Input:
0
Expected Output:
Valid Score
Input:
100
Expected Output:
Valid Score
Input:
-10
Expected Output:
Error: Score must be between 0 and 100
Input:
150
Expected Output:
Error: Score must be between 0 and 100
❌ Some tests failed
❌ エラー発生

Your Solution

Current Mode: My Code
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here

sc.close();
}
}
0 B / 5 MB

You have 9 free executions remaining