Drill2Solutions

Drill2Solutions - /class FindZodiacSign /Tell someone their...

Info iconThis preview shows pages 1–2. 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); int year, remainder; System.out.print("Please enter your birth year: "); year = input.nextInt(); // determine which year in the cycle it is remainder = year % 12; // depending on the year in the cycle, print out the animal if (remainder == 0) System.out.println("You are the year of the Monkey."); else if (remainder == 1) System.out.println("You are the year of the Rooster."); else if (remainder == 2) System.out.println("You are the year of the Dog."); else if (remainder == 3) System.out.println("You are the year of the Pig."); else if (remainder == 4) System.out.println("You are the year of the Rat."); else if (remainder == 5) System.out.println("You are the year of the Ox."); else if (remainder == 6) System.out.println("You are the year of the Tiger."); else if (remainder == 7) System.out.println("You are the year of the Rabbit.");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/27/2011 for the course CMPSC 5 taught by Professor Franklin during the Fall '09 term at UCSB.

Page1 / 2

Drill2Solutions - /class FindZodiacSign /Tell someone their...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online