Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-08-2008, 09:30 AM
Member
 
Join Date: Nov 2007
Posts: 38
carlos123 is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-08-2008, 11:37 AM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 840
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
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.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)

Last edited by CaptainMorgan : 01-09-2008 at 04:39 AM.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-09-2008, 04:36 AM
Member
 
Join Date: Nov 2007
Posts: 38
carlos123 is on a distinguished road
ty
any other suggestions?
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 01-09-2008, 04:40 AM
Member
 
Join Date: Nov 2007
Posts: 38
carlos123 is on a distinguished road
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]); }
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting network card address in Java 6 Java Tip Java Tips 0 03-02-2008 08:10 PM
Card program , need help thanks. carlos123 New To Java 2 12-31-2007 08:23 AM
drawing window BlitzA New To Java 0 12-30-2007 05:45 PM
Drawing outside paintComponent() DarkSide1 Java 2D 2 11-08-2007 11:36 PM
Help with Drawing a line Rgfirefly24 New To Java 1 08-06-2007 09:40 AM


All times are GMT +3. The time now is 03:58 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org