|
-
January 17th, 2011, 04:49 PM
#1
Java Programming Code Help
Okay guys I have been working on a code in creating a solt machine! I already made half the code but I want to encorporate arrays, if loops and for and while loops in there as well.
Other than that I am pretty much set! The Selection and Repetition consturcts aren't the main problem though, the real problem for me is arrays, can someone possible help me?
Code:
// import the java.util.Random class:
import java.io.*;
import java.util.Random;
public class SlotMachine
{
public static void main(String args[]) throws IOException{
Random randomizer = new Random();
String a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
int ai=0, bi=0;
InputStreamReader input = new InputStreamReader(System.in);
BufferedReader reader= new BufferedReader(input);
System.out.println("Please enter in the money you want to bet");
b=reader.readLine();
bi=Integer.parseInt(b);
int ci = randomizer.nextInt(10);
int di = randomizer.nextInt(10);
int ei = randomizer.nextInt(10);
int fi = randomizer.nextInt(10);
int gi = randomizer.nextInt(10);
int hi = randomizer.nextInt(10);
int ii = randomizer.nextInt(10);
int ji = randomizer.nextInt(10);
int ki = randomizer.nextInt(10);
int li = randomizer.nextInt(10);
int mi = randomizer.nextInt(10);
int ni = randomizer.nextInt(10);
int oi = randomizer.nextInt(10);
int pi = randomizer.nextInt(10);
int qi = randomizer.nextInt(10);
int ri = randomizer.nextInt(10);
System.out.println(ci +"\t" + di+"\t" + ei+"\t" + fi);
System.out.println(gi +"\t" + hi+"\t" + ii+"\t" + ji);
System.out.println(ki +"\t" + li+"\t" + mi+"\t" + ni);
System.out.println(oi +"\t" + pi+"\t" + qi+"\t" + ri);
}
}
Keep it simple please! Thanks in advance!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|