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 @ 4:15pm
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; 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()); int count=0; while (count<=20) { if (num2 <= 10 | num2 >= 100) { showStatus("Not withen Range"); } else if (count>=20) { showStatus("No Numbers Left."); } else if (x[num2]==0) { x[num2] = 1; ++count; } else { showStatus ("Duplicate!"); ++count; } } for (int i=10; i>=100; i++) { if (x[i]==1) i = output; repaint(); } } }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.50 / 8
151 Votes
http://codebin.yi.org/126
page generated in 0.01 seconds