Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-01-2012, 08:52 AM   PM User | #1
leong6135
New to the CF scene

 
Join Date: Oct 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
leong6135 is an unknown quantity at this point
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
1 “Ace”
2 through 10 “2” through “10”
11 “Jack”
12 “Queen”
13 “King”

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.
leong6135 is offline   Reply With Quote
Old 10-01-2012, 02:14 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,647
Thanks: 4
Thanked 2,450 Times in 2,419 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Okay, and what exactly is it you are stuck on?
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:08 PM.


Advertisement
Log in to turn off these ads.