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
package com.task;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println("Enter college year: ");
Scanner in = new Scanner(System.in);
Integer year = Integer.valueOf(in.nextLine());
String range = "Unlisted";
if (year == 4) {
range = "Senior";
} else if (year == 3) {
range = "Junior";
} else if (year == 2) {
range = "Sophomore";
} else if (year == 1) {
range = "Freshmen";
}
System.out.println(range);
}
}
Comments
Leave a comment