The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled Java Code
Posted by: asd | March 11, 2008 @ 3:38pm
Java Code
[
Download
]
/** * @author Danny Harbison D4 2/25/08 * */ import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class array extends Applet implements ActionListener { /** * */ Label prompt2; TextField input2; int num1, num2, output, count; int x[] = new int[101]; public void init() { prompt2=new Label("Enter One of Your 20 Numbers"); add(prompt2); input2=new TextField(10); input2.addActionListener(this); add(input2); } public void paint(Graphics g) { g.drawString("Your Numbers are "+ output,70,75); } public void actionPerformed(ActionEvent e) { num2=Integer.parseInt(input2.getText()); while (count <= 20){ if (num2 >= 10 && num2 <= 100) { if (x[num2] == 0) { x[num2] = 1; ++count; } else { ++count; showStatus ("Duplicated Number"); } } else showStatus ("Out of Range"); } for (int i=10; i>=100; i++) { if (x[i]==1) i = output; } } }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.49 / 8
158 Votes
http://codebin.yi.org/125
page generated in 0.00 seconds