Click here to Skip to main content
15,558,869 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Just to be clear, this is not homework, I've tried other sites for this and they kick me out because this kinda looks like it. I'm just trying to win a bet with my sanctimonious programmer friend, he didn't think that I could make a card game in Java, but I'm a novice programmer, so I'm asking you guys for help. This is as specific as I can make it, please let me know if there's anything else I need to provide. I also need this rather soon, if it's not too hard to make.

Please create a class called Card that can be used to represent a playing card.
A Card should have a suit (heart, diamond, club, or spade) and a numeric value (lets use ace as 1 up through king as 13).
Create a class called Deck that can be used to represent a deck of 52 playing cards.
The Deck class should have an array of type Card that contains one of each possible card.
The Deck constructor should create a sorted deck of Cards (like you just took it out of the box).
In addition, the Deck class should have a shuffle() method.
You should use whatever approach is easiest to create a well-shuffled deck of cards.
In addition to the shuffle() method, the Deck class should have a drawCard() method that picks a card at random from the deck and somehow marks it so it cannot be redrawn.
Finally, the Deck class should have a removeCard() method that takes a specific card as a parameter and removes it from the Deck (for games that do not use both Jacks etc.)
Thank you!
Posted
Updated 5-Dec-12 21:01pm
v2
Comments
Sergey Alexandrovich Kryukov 5-Dec-12 21:59pm    
And the problem is..?
--SA
TorstenH. 6-Dec-12 2:03am    
this is homework - no matter if you do it as homework, it still is one.
We will help you - but we do not provide ready made solutions.
Also - it's easy to see if it's written by you or a pro.

So please post code and ask specific.

I'm just trying to win a bet with my sanctimonious programmer friend, he didn't think that I could make a card game in Java

And you have just proved him right.
 
Share this answer
 
Comments
CPallini 6-Dec-12 4:02am    
5.
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!
 
Share this answer
 
As Richard well said, you shouldn't cheat to win your bet: after all you may win it honestly.
What are your troubles in satisfying such requirements? They don't look daunting to me.
Start coding, have fun, and post here specific questions when you get stuck.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900