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;
  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. num2=Integer.parseInt(input2.getText());
  41. int count=0;
  42. while (count<=20) {
  43. if (num2 <= 10 | num2 >= 100)
  44. {
  45. showStatus("Not withen Range");
  46. }
  47. else if (count>=20)
  48. {
  49. showStatus("No Numbers Left.");
  50. }
  51. else if (x[num2]==0)
  52. {
  53. x[num2] = 1;
  54. ++count;
  55. }
  56. else { showStatus ("Duplicate!");
  57. ++count;
  58. }
  59.  
  60.  
  61. }
  62.  
  63. for (int i=10; i>=100; i++) {
  64. if (x[i]==1) i = output;
  65. repaint();
  66. }
  67. }
  68. }