Answer to Question #280242 in Java | JSP | JSF for Bjoy

Question #280242

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

1
Expert's answer
2021-12-20T09:57:35-0500
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);
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog