Drill2Solutions

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

This preview shows pages 1–2. Sign up to view the full content.

//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.");

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

View Full Document
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
Ask a homework question - tutors are online