Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Thecount2

By: ace on May 5th, 2010  |  syntax: None  |  size: 1.36 KB  |  hits: 27  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.util.ArrayList;
  2.  
  3. /**
  4.  * Write a description of class TheCount here.
  5.  *
  6.  * @author (your name)
  7.  * @version (a version number or a date)
  8.  */
  9. public class TheCount
  10. {
  11.     // instance variables - replace the example below with your own
  12.     private ArrayList <String> counter;
  13.  
  14.     /**
  15.      * Constructor for objects of class TheCount
  16.      */
  17.     public TheCount()
  18.     {
  19.         // initialise instance variables
  20.         counter = new ArrayList<String>();
  21.     }
  22.  
  23.     private void fillCount(int index, String count)
  24.         {
  25.           counter.add(0, "one");
  26.           counter.add(1, "two");
  27.           counter.add(2, "three");
  28.           counter.add(3, "four");
  29.           counter.add(4, "five");
  30.           counter.add(5, "six");
  31.           counter.add(6, "seven");
  32.           counter.add(7, "eight");
  33.           counter.add(8, "nine");
  34.           counter.add(9, "ten");
  35.           }
  36.    
  37.     /**
  38.      * An example of a method - replace this comment with your own
  39.      *
  40.      * @param  y   a sample parameter for a method
  41.      * @return     the sum of x and y
  42.      */
  43.    public int tenTo10(String count)
  44.       {
  45.  int index = 0;
  46.  while (index <= 8)
  47.     {
  48.         if (counter.get(index).contentEquals(count))
  49.         {
  50.            
  51.    System.out.println (index+1);
  52.    return index+1;
  53. }
  54.     index++;
  55. }
  56. return 0;
  57. }
  58.        
  59.    
  60.  
  61. }