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. int x[] = new int[101];
  19.  
  20. public void init()
  21. {
  22.  
  23. prompt2=new Label("Enter One of Your 20 Numbers");
  24. add(prompt2);
  25.  
  26. input2=new TextField(10);
  27. input2.addActionListener(this);
  28. add(input2);
  29.  
  30. }
  31.  
  32. public void paint(Graphics g)
  33. {
  34. g.drawString("Your Numbers are "+ output,70,75);
  35.  
  36. }
  37.  
  38.  
  39. public void actionPerformed(ActionEvent e)
  40. {
  41. num2=Integer.parseInt(input2.getText());
  42. while (count <= 20){
  43. if (num2 >= 10 && num2 <= 100) {
  44. if (x[num2] == 0)
  45. {
  46. x[num2] = 1;
  47. ++count;
  48. }
  49. else
  50. {
  51. ++count;
  52. showStatus ("Duplicated Number");
  53. }
  54.  
  55. }
  56. else showStatus ("Out of Range");
  57.  
  58. }
  59.  
  60. for (int i=10; i>=100; i++) {
  61. if (x[i]==1) i = output;
  62. }
  63.  
  64. }
  65.  
  66. }