Results 1 to 4 of 4
- 01-08-2008, 08:30 AM #1
Member
- Join Date
- Nov 2007
- Posts
- 38
- Rep Power
- 0
a little help needed for card drawing
i was told to write a program in java for a friend, i know almost nothing of java, and came here for help
-i need a class that draws 1 card from a 52 card deck and displays the value of the card.
-a class that will draw 5 cards from a deck of cards 9 – A (single deck) and displays them.
thanks in advance.
again, im not a programmer, but any suggestions are helpful
- 01-08-2008, 10:37 AM #2
If a friend told you to write a program, knowing that you know nothing about the given language - well, that's just not a very thoughtful friend. An even better friend would be Head First Java by Kathy Sierra and Bert Bates.
Last edited by CaptainMorgan; 01-09-2008 at 03:39 AM.
Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice? Vote now!
Got a little Capt'n in you? (drink responsibly)
- 01-09-2008, 03:36 AM #3
Member
- Join Date
- Nov 2007
- Posts
- 38
- Rep Power
- 0
ty
any other suggestions?
- 01-09-2008, 03:40 AM #4
Member
- Join Date
- Nov 2007
- Posts
- 38
- Rep Power
- 0
Java Code:public class Random_Gen { int min; //minimum number that can be generated. int max; //maximum number that can be generated. int value; public Random_Gen(int n, int m) { max = m; //code goes in this class min = n; } public int getRandom() { return value; } } public static void main(String[] args) { int min = 1; // smallest number that can be generated int max = 20; // largest number that can be generated Random_Gen rg = new Random_Gen(min, max); int num; int[] frequency = new int[max]; for (int x = 0; x < 10000; x++) { num = rg.getRandom(); System.out.println(num); for (int index = 0; index < max; index ++) //determines frequency { if (num == index + 1) frequency[index]++; } } for (int index = 0; index < max; index ++) // displays frequency { System.out.println(""+(index+1) + " = " + frequency[index]); }
Similar Threads
-
drawing window
By BlitzA in forum New To JavaReplies: 1Last Post: 01-15-2009, 12:55 PM -
Getting network card address in Java 6
By Java Tip in forum Java TipReplies: 0Last Post: 03-02-2008, 07:10 PM -
Card program , need help thanks.
By carlos123 in forum New To JavaReplies: 2Last Post: 12-31-2007, 07:23 AM -
Drawing outside paintComponent()
By DarkSide1 in forum Java 2DReplies: 2Last Post: 11-08-2007, 10:36 PM -
Help with Drawing a line
By Rgfirefly24 in forum New To JavaReplies: 1Last Post: 08-06-2007, 08:40 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks