Hi everyone, I hope you guys can help me.
Output
Enter your department number:
You belong to:
1-3 = Mr.X
4-7 = Mr.Y
8-9 = Mr.Z
------
Error:
When I input numbers from 1-9, the output that is displayed is always "You belong to: Mr. Z"
Here's my code:
import java.io.*;
public class Test5
{
public static BufferedReader input=new BufferedReader (new InputStreamReader(System.in));
public static void main(String args[])
{
String Department;
int dept=0;
try{
System.out.println("Enter Department:");
Department=input.readLine();
}
catch(IOException ioe) {}
if (dept<=9){
System.out.println("You belong to: Mr.Z");
}else if (dept<=7){
System.out.println("You belong to: Mr.Y");
}else if (dept<=3){
System.out.println("You belong to: Mr.X");
}
}
}