Results 1 to 4 of 4
Thread: Card
- 08-13-2009, 01:57 PM #1
Member
- Join Date
- Jun 2009
- Posts
- 35
- Rep Power
- 0
Card
I have to simulate shuffling and dealing of card(any card game).
What i have done is created, enum types of Suit and Rank in a class called Card and the constructor
public Card(Suit suit, Rank rank)
{
if(suit ==null || rank ==null)
throw new NullPointerException(rank+" , "+suit);
this.suit = suit;
this.rank = rank;
}
i think i have to use an arrayList to put a rank and its corresponding suit, thus shuffling it but can't figure out how.
Any help would be highly appreciated!!
-
Create a Deck class that holds an ArrayList<Card>. In the Deck class have a shuffle() method that shuffles the arraylist via Collections.shuffle(...). If you search this forum or the Sun fora you'll find many examples of this as it is an assignment that has been given to students for years. Best of luck.
-
- 08-13-2009, 02:20 PM #4
Member
- Join Date
- Jun 2009
- Posts
- 35
- Rep Power
- 0
Similar Threads
-
Can we access sim card from computer
By rajasekharpv in forum Sun Java Wireless ToolkitReplies: 3Last Post: 09-03-2009, 03:22 PM -
card game Rummy
By javafox in forum New To JavaReplies: 4Last Post: 03-14-2009, 03:53 PM -
Card Layout
By Gilbee in forum NetBeansReplies: 3Last Post: 03-03-2009, 09:37 PM -
A Online Card Game
By GonzaloP in forum NetworkingReplies: 0Last Post: 12-28-2008, 06:37 PM -
Card program , need help thanks.
By carlos123 in forum New To JavaReplies: 2Last Post: 12-31-2007, 07:23 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks