1. /**
  2.  * @author Danny Harbison D4 2/25/08
  3.  *
  4.  */
  5.  
  6. import java.applet.Applet;
  7. import java.awt.*;
  8. import java.awt.event.*;
  9.  
  10. public class array extends Applet
  11. implements ActionListener {
  12. /**
  13. *
  14. */
  15. Label prompt2;
  16. TextField input2;
  17. int num1, num2, output, count;
  18.  
  19. public void init()
  20. {
  21.  
  22. prompt2=new Label("Enter One of Your 20 Numbers");
  23. add(prompt2);
  24.  
  25. input2=new TextField(10);
  26. input2.addActionListener(this);
  27. add(input2);
  28.  
  29. }
  30.  
  31. public void paint(Graphics g)
  32. {
  33. g.drawString("Your Numbers are "+ output,70,75);
  34.  
  35. }
  36.  
  37.  
  38. public void actionPerformed(ActionEvent e)
  39. {
  40. num2=Integer.parseInt(input2.getText());
  41. int x[] = new int[101];
  42. if (num2 >= 10 && num2 <= 100) {
  43. if (x[num2] == 0) {
  44. x[num2]++;
  45. showStatus(""+ ++count);
  46. } else {
  47. //duplicate
  48. showStatus ("Duplicated Number");
  49. }
  50.  
  51. }
  52. else showStatus ("Out of Range");
  53.  
  54. for (int i=10; i>=100; i++) {
  55. if (x[i]==1) i = output;
  56. }
  57.  
  58. }
  59. }