Java Programming Help Again please :'(

10/06/2011 04:12 zepolzirk#1
How do i do this program???

Create an array that will Input a year (valid years are starting from 1900 onwards) then output the index number and the animal sign of the entered year. These are the sequence of the animal signs: RAT, OX, TIGER, RABBIT, DRAGON, SNAKE, HORSE, SHEEP, MONKEY, ROOSTER, DOG, PIG.

Sample output:

Enter a year: 1200
<<VALID INPUT STARTS AT 1900>>
Enter a year: 1984

The index number is 0
The animal sign of a person born in the year 1984 is "RAT"

process completed.

how do i do this? so confusing ..this is an activity in my school. Hope you can help me thanks !
10/06/2011 09:48 Obilee#2
Code:
import java.io.IOException;
import java.util.Scanner;




public class TestMain {
  public static void main(String args[]) throws IOException {
	 
	  boolean legit = false;
	  Scanner s = new Scanner(System.in);	    
	  String[] animals = {"RAT", "OX", "TIGER", "RABBIT", "DRAGON", "SNAKE", "HORSE", "SHEEP", "MONKEY", "ROOSTER", "DOG", "PIG"};
	  
	  
	  while(!legit){
		  System.out.print("Enter a year: ");
		  int year = s.nextInt();
		  
		  if(year < 1900)
			  System.out.println("<<VALID INPUT STARTS AT 1900>>");
		  else{
			legit = true;
			
			 /**  OUTPUT WITH THE YEAR*/
		  }		  
	  }
  }
}
how to get the right animal is the task for you, i wont do all the stuff for you :P