Results 1 to 3 of 3
- 09-07-2010, 08:38 PM #1
Senior Member
- Join Date
- May 2010
- Posts
- 112
- Rep Power
- 0
Class exercise CS106A (Stanford university)
Hi all,
I am doing this exercise of chapter 6 of the book "Art and science of Java" by Eric Robert.I do not understand what this question is asking me to do.If I can understand the question I guess i can handle answer.Here's the question:
Implement a new class called Card that includes the following entries:
• Named constants for the four suits (CLUBS, DIAMONDS, HEARTS, SPADES) and the
four ranks that are traditionally represented in words (ACE, JACK, QUEEN, KING).
The values of the rank constants should be 1, 11, 12, and 13, respectively.
• A constructor that takes a rank and a suit and returns a Card with those values.
• Accessor methods getRank and getSuit to retrieve the rank and suit components
of a card.
• An implementation of the toString method that returns the complete name of the
card as in exercise 1. Remember that you can use the + operator to connect the
different parts of the string together, as shown in the toString implementation
for the Rational class in Figure 6-9.
- 09-07-2010, 09:04 PM #2
Funny, normally questions end with a question mark. I don't see any in your post.Here's the question:
It looks like the statement of requirements for an assignment.
Can you go through your assignment line by line and ask specific questions about what you don't understand?
- 09-11-2010, 01:47 AM #3
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
i would go enum for rank and suit, check it out. here is a little dirty secret programmers are expected to find out all sorts of information that they never knew before, yeah it is true, you actually have to find things out for yourself.I dont mean to be hard but you know start as you mean to continue.
Similar Threads
-
CS106A Stanford University
By Learning Java in forum New To JavaReplies: 116Last Post: 07-09-2011, 04:43 PM -
How to run java class in ECLIPSE(CS106A Stanford)
By ccie007 in forum New To JavaReplies: 17Last Post: 09-11-2010, 12:18 AM -
Java Checkerboad question CS106A Stanford univerity
By ccie007 in forum New To JavaReplies: 69Last Post: 05-25-2010, 12:35 PM -
Help for University Project
By ja107 in forum NetworkingReplies: 3Last Post: 03-18-2010, 10:22 AM -
simple exercise for class, help please?
By Boomer1 in forum Other IDEsReplies: 10Last Post: 11-02-2009, 06:12 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks