CS-140 Programming with Objects
Fall 2013
Programming Project 1

Assigned : 09/27/2013
Due : 10/20/2013 (Midnight)

Objective: To introduce the student to the concepts of:
1. Class implementation and design
2. Array based manipulations, loops,
3. practice using jUnit for unit testing

Write a program that will be a simulation of a Solitaire game. Design and implement appropriate Classes for card, deck and playing board representation. The program should not be user interactive (i.e.the program shall not interactively play the game with the user but rather play the entire game). Output, in an easily understood format, the status of the game after each move. If you have questions about game rules...ask.

For either option the following classes to be developed:

1. Card with operations of (at a minimum, other operations may be added to this set as determined by your design): The attributes of a card value, suit and status (face up/face down).

  a. Constructor Card(Suit s, value v, status f)
     pre - Card does not exist
     post - Card exists with attributes s,v,f

  b. void FaceUp()
     pre - Card exists
     post - Card.status := FaceUp

  c. void FaceDown()
     pre - Card exists
     post - Card.status := FaceDown

  d. status CardStatus()
     pre - Card exists
     post - Card is unchanged; current status value of C is returned to user

  e. value CardValue()
     pre - Card exists
     post - Card is unchanged; current value of C is returned to user

  f. suit CardSuit()
     pre - Card exists
     post - Card is unchanged; Suit of C is returned to user

2. PileOfCards with operations of (at a minimum, other operations may be added as required by your design):

  a. constructor()
     pre - Pile does not exist
     post - Pile exists but contains no cards

  b. PileOfCards MakeDeck( )
     pre - Pile exists
     post - Pile exists and has been initialized as standard 52 card deck

  c. PileOfCards Shuffle( )
     pre - Pile exists
     post - a pseudo random ordering has been assigned to N
            Shuffle should be performed from a normalized dec k; i.e.
            one that is ordered by suit and value within suit. Whenever
            a deck needs to be shuffled it should be put into normal
            order before shuffling.

  d. card TakeTopCard()
     pre - Card c and PileOfCards p exist
     post - the top card in p is removed from p and its s,v,f attributes are assigned to C

  e. void AddCardToPile(card c)
     pre - Card c and PileOfCards p exist
     post - card c is added to the top of PileOfCards p; c loses its own identity

These data types should be designed generically enough to be easily used for any common card game, this will require that you take into account the uses of "pileofcards" and "card" in other commonly played card games.

At run time the program should pause until the operator presses the enter key after each move is made The screen should show the playing board prior to the move and the plaring board after the play so that the move can be verified visually. The playing board should also be written to a file so it could be printed and analysed later.

FTP all source code files (including your junit test harnessesto your FTP account at bigblackbox.cs.binghamton.edu and send a note to your TA when your project is ready for grading.

Last updated: 09/27/2013 - rvs