/home/caleb/ASDV-Java/lab8_CalebFontenot/src/main/java/com/calebfontenot/lab8_calebfontenot/Switch1ConvertedToIfElse.java |
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
package com.calebfontenot.lab8_calebfontenot;
import java.util.Scanner;
public class Switch1ConvertedToIfElse {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a year to tell you a Chinese joke: ");
int year = input.nextInt();
if (year == 0)
System.out.println("monkey");
else if (year == 1)
System.out.println("rooster");
else if (year == 2)
System.out.println("dog");
else if (year == 3)
System.out.println("pig");
else if (year == 4)
System.out.println("rat");
else if (year == 5)
System.out.println("ox");
else if (year == 6)
System.out.println("tiger");
else if (year == 7)
System.out.println("rabbit");
else if (year == 8)
System.out.println("dragon");
else if (year == 9)
System.out.println("snake");
else if (year == 10)
System.out.println("horse");
else if (year == 11)
System.out.println("sheep");
}
}