| Lab |
Assigned |
Design Due (In class) 10 AM |
Implement (In Lab) |
Demo (In Lab) |
Lab Due (In class) Friday 10 AM |
| | 4 | Nov |
8 | Nov |
5-6 | Nov |
12-13 | Nov |
15 | Nov |
Goals:
By the end of this lab you should:
- Gain experience with design
- Understand the fundmanetals of subclassing
- Understand the basics of using mouse listeners
Before Starting:
- Read over this entire document before you start.
- Review the rules of Hearts
- Play some hands of Hearts with friends, or look for a website
for hears using Google
Note: I checked out some of these links and there are
multiplayer Hearts games written in Java on the web. These use sockets
and other abstractions you will study in CS 102. -- RC
- Review the objects you have implemented in
Lab 7a and Lab 7b .
- Run the Sample Solution
- For extra material, read the Mouse Listener Tutorial . You do not need
to know all of that for this lab, but you may find it interesting.
This is the first of two labs where we give you almost no software
as a base. You are to develop a design for the Hearts game, and then
implement the game according to your design.
The following questions are intended to help you think through your
design.
- What controls the play of your game? You may want to think about
an object (GameController) that causes things to happen in the right order.
Study or
play Hearts to see what must be done, from dealing the cards to finding
out who won the game.
- What kinds of things must a player be able to do in Hearts? We will
have two kinds of players in your game: automatic and human. Three of
the players are automatic and the other is Human. Whatever common behavior
they share should be put into a superclass, say
Player, and
the specific behavior can be refined in the subclasses.
- How is a
Card object used in Hearts? If extra functionality
is needed, think about subclassing Card to admit that
functionality.
- Same issue with
Hand. there are many collections of
cards in Hearts: a playre's hand, a player's discard pile, a trick in
play. Each of these might be a Hand, but if extra
functionality is needed, extend Hand and add the appropriate
methods.
What to turn in:
- Complete a design cover sheet and
turn in JavaDoc printouts when the design is due.
- Complete a code cover sheet and
postscript printouts of your Java files when the code is due.
Also, Provide the transcript from any tests you run.