Create a program that will display the corresponding college level of s given input year level. The year and the college are given below:
Note: Use if else if statement.
Year Level College Level
1 Freshmen
2 Sophomore
3 Junior
4 Senior
Other years Unlisted Level
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter the year:");
int year = in.nextInt();
if (year == 1) {
System.out.println("Freshmen");
} else if (year == 2) {
System.out.println("Sophomore");
} else if (year == 3) {
System.out.println("Junior");
} else if (year == 4) {
System.out.println("Senior");
} else {
System.out.println("Unlisted Level");
}
}
}
Comments
Leave a comment