Results 1 to 3 of 3
  1. #1
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

    Default 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.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,458
    Rep Power
    25

    Default

    Here's the question:
    Funny, normally questions end with a question mark. I don't see any in your post.
    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?

  3. #3
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Default

    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

  1. Java Checkerboad question CS106A Stanford univerity
    By ccie007 in forum New To Java
    Replies: 71
    Last Post: 09-20-2013, 04:02 AM
  2. CS106A Stanford University
    By Learning Java in forum New To Java
    Replies: 116
    Last Post: 07-09-2011, 04:43 PM
  3. How to run java class in ECLIPSE(CS106A Stanford)
    By ccie007 in forum New To Java
    Replies: 17
    Last Post: 09-11-2010, 12:18 AM
  4. Help for University Project
    By ja107 in forum Networking
    Replies: 3
    Last Post: 03-18-2010, 10:22 AM
  5. simple exercise for class, help please?
    By Boomer1 in forum Other IDEs
    Replies: 10
    Last Post: 11-02-2009, 06:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •