Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Need help on coding!!!
10-01-2012, 08:52 AM #1
- Join Date
- Oct 2012
- Thanked 0 Times in 0 Posts
Need help on coding!!!
Below is my assignment due on friday.Anyone can help on this ???
Playing cards are used in many computer games, including versions of such classics as Solitaire, hearts, and Poker. Design a Card class that contains a character data field to hold a suit of string (“Spades”, “Hearts”, Diamonds”, or “Clubs”), an integer data filed for a value from 1 to 13, and field to hold the string representation of a Card’s rank based on its value as below :
Numeric Value String Value for rank
2 through 10 “2” through “10”
Include get and set methods for each field, save the class as Card.java.
Write the application so the suit and value both are chosen randomly. Using the two Card objects, play a very simple version of the card game War.
Deal two cards, one for computer and one for the player and determine the higher card, then display the two card details (such as Ace – Spades” ) and a message indicating whether the cards are equal, the computer won or the player won (Playing cards are considered equal when they have the same value, no matter what their suit is)
Play 10 rounds of the War game and display a count of the number of times the player wins, the number of times the computer wins, and the number of tie.
Save the game as War.java.
Note: You are encouraged to use predefined methods to organized your War applications.
10-01-2012, 02:14 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,650 Times in 2,619 Posts
Okay, and what exactly is it you are stuck on?