019-001-002
Score Validation Program: Range Validation and Exception Handling
Medium
Problem Description
In this problem, you will create a program that validates a test score (0-100 points) and throws an IllegalArgumentException if the score is outside the valid range. Determine whether the score falls within the valid range (0 to 100 inclusive), and throw an exception if it does not. 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
Normal case
Input:
80
Expected Output:
Valid Score
Normal case
Input:
55
Expected Output:
Valid Score
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
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 10 free executions remaining
