ex8 - break; case (4): animal =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//class FindZodiacSign //Tell someone their Chinese zodiac sign import java.util.Scanner; public class FindZodiacSign { public static void main (String args[]) { Scanner input = new Scanner (System.in); System.out.print(.Please enter your birth year: .); int remainder = input.nextInt() % 12; String animal; // determine which animal it is switch (remainder) { case (0): animal = "Monkey"; break; case (1): animal = "Rooster"; break; case (2): animal = "Dog"; break; case (3): animal = "Pig";
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: break; case (4): animal = "Rat"; break; case (5): animal = "Ox"; break; case (6): animal = "Tiger"; break; case (7): animal = "Rabbit"; break; case (8): animal = "Dragon"; break; case (9): animal = "Snake"; break; case (10): animal = "Horse"; break; case (11): animal = "Ram"; break; } // depending on the year in the cycle, print out the animal System.out.println("You are the year of the " + animal); } //end of main }//end of class FindZodiacSign...
View Full Document

Ask a homework question - tutors are online