Programming and Problem Solving with Java

(やまだぃちぅ) #1

CASE STUDY


30


PARTY PLANNING
Problem:You and some friends want to have a party on Saturday night, and you need to
plan and prepare for it.

Discussion:You’re familiar with the problem from having attended many parties.
Parties can be fun or they can turn into disasters. You know that it takes a great deal of
preparation to throw a party that everyone enjoys. Let’s start with some means-ends
analysis. The starting state is that you want to have a party, and the goal state is that
your party ends with everyone having had a good time. Your means are you and your
friends—you need to examine their capabilities more closely.
One of your friends, Sally, has a car. Another, James, has a stereo and a large music
collection. You have an apartment with a big living room. All of you know people who
you want to invite, and you all have ideas about what makes a great party. You collabo-
rate with your friends to develop a guest list. From your experience with parties that
have gone well (looking for things that are familiar), you and your friends identify the
major steps in the process: invite people, get food, choose music and set up the stereo,
clean the apartment and move furniture, welcome guests, have snacks available and
some background music playing while people arrive, dance for most of the evening,
wind down with some party games, and say goodbye to guests as they leave.
Now it’s time to divide and conquer all of this work. Sally can help James deliver the
stereo and can get the food. James can set up the stereo and select the music. You can
clean the apartment and move the furniture (with everyone’s help). Each of you can call
and invite some of the people, keeping a count of the ones who can come. Sally can
then get those counts from you and James, and figure out how much food to buy. On
the evening of the party, you can answer the doorbell, James can run the stereo and
help lead the games, and Sally can take care of the food. After the party, everyone can
help clean up, and Sally can help James take the stereo back to his apartment.
Here is a list of the “objects” we’ve identified and their responsibilities:

Yo u
Call guests and keep a count of the ones who can come.
Clean apartment.
Move furniture.
Answer doorbell.
Say goodbye to leaving guests.
Clean up apartment and move furniture back.

T


E


A


M


F


L


Y


Team-Fly®

Free download pdf