Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 15101194S
- //Import Scanner
- import java.util.Scanner;
- public class CheckHoroscope
- {
- public static void main(String[] args)
- {
- //Title
- System.out.println("Check Horoscope / Chinese Zodiac Sign Calculator");
- //Scanner
- Scanner sc = new Scanner(System.in);
- //Insert Year
- System.out.print("Enter your birth year: ");
- int BirthYear = sc.nextInt();
- //Calculation
- int BirthYearCal = BirthYear % 12;
- //Output
- if (BirthYearCal == 4)
- System.out.println("Your horoscope sign: Rat");
- if (BirthYearCal == 5)
- System.out.println("Your horoscope sign: Cow");
- if (BirthYearCal == 6)
- System.out.println("Your horoscope sign: Tiger");
- if (BirthYearCal == 7)
- System.out.println("Your horoscope sign: Rabbit");
- if (BirthYearCal == 8)
- System.out.println("Your horoscope sign: Dragon");
- if (BirthYearCal == 9)
- System.out.println("Your horoscope sign: Snake");
- if (BirthYearCal == 10)
- System.out.println("Your horoscope sign: Horse");
- if (BirthYearCal == 11)
- System.out.println("Your horoscope sign: Goat");
- if (BirthYearCal == 0)
- System.out.println("Your horoscope sign: Monkey");
- if (BirthYearCal == 1)
- System.out.println("Your horoscope sign: Chicken");
- if (BirthYearCal == 2)
- System.out.println("Your horoscope sign: Dog");
- if (BirthYearCal == 3)
- System.out.println("Your horoscope sign: Pig");
- //Error
- if (BirthYear < 0)
- System.out.println("Invalid input.");
- //Output
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement