-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
45 lines (38 loc) · 1.02 KB
/
Main.java
File metadata and controls
45 lines (38 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* @exercise: Sala de Aula
* @author: Rodrigo Andrade
* @date: 25 Feb 2026
* @license: MIT
* @language: Java
* @github: https://github.com/Rorchive/C06
*/
package com.rodrigoandrade;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println("Students number:");
Scanner input = new Scanner(System.in);
short students;
// Check for short overflow
try {
students = input.nextShort();
} catch (Exception e) {
input.close();
System.out.println("Invalid students number.");
return;
}
switch (students) {
case 10:
case 20:
System.out.println("Classroom: I-6");
break;
case 30:
System.out.println("Classroom: I-5");
break;
default:
System.out.println("No classroom available.");
break;
}
input.close();
}
}