Advertisement
Mhazard

Java CheckHoroscope

Oct 29th, 2015
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.92 KB | None | 0 0
  1. // 15101194S
  2.  
  3. //Import Scanner
  4. import java.util.Scanner;
  5. public class CheckHoroscope
  6. {
  7.         public static void main(String[] args)
  8.         {
  9.              //Title
  10.              System.out.println("Check Horoscope / Chinese Zodiac Sign Calculator");
  11.              //Scanner
  12.              Scanner sc = new Scanner(System.in);
  13.              //Insert Year
  14.              System.out.print("Enter your birth year: ");
  15.              int BirthYear = sc.nextInt();
  16.              //Calculation
  17.              int BirthYearCal = BirthYear % 12;
  18.              //Output
  19.              if (BirthYearCal == 4)
  20.                     System.out.println("Your horoscope sign: Rat");
  21.              if (BirthYearCal == 5)
  22.                  System.out.println("Your horoscope sign: Cow");
  23.              if (BirthYearCal == 6)
  24.                  System.out.println("Your horoscope sign: Tiger");
  25.              if (BirthYearCal == 7)
  26.                  System.out.println("Your horoscope sign: Rabbit");
  27.              if (BirthYearCal == 8)
  28.                  System.out.println("Your horoscope sign: Dragon");
  29.              if (BirthYearCal == 9)
  30.                  System.out.println("Your horoscope sign: Snake");
  31.              if (BirthYearCal == 10)
  32.                  System.out.println("Your horoscope sign: Horse");
  33.              if (BirthYearCal == 11)
  34.                  System.out.println("Your horoscope sign: Goat");
  35.              if (BirthYearCal == 0)
  36.                  System.out.println("Your horoscope sign: Monkey");
  37.              if (BirthYearCal == 1)
  38.                  System.out.println("Your horoscope sign: Chicken");
  39.              if (BirthYearCal == 2)
  40.                  System.out.println("Your horoscope sign: Dog");
  41.              if (BirthYearCal == 3)
  42.                  System.out.println("Your horoscope sign: Pig");
  43.          //Error
  44.          if (BirthYear < 0)
  45.                  System.out.println("Invalid input.");
  46.              //Output
  47.          }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement