Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Student class includes:

  • the name of the student,
  • the closet shelf with its piles of clean clothes,
  • the dirty laundry pile, and
  • the laundry room with its piles of laundered garmets sitting on tables.
  • and methods to

...

  • manipulate those data representations to perform the specified simulation.

Wiki Markup
When the simulation begins, Acker is wearing _white_ pants, _white_ socks, and a _white{_}shirt. The closet shelf, dirty laundry pile, and laundry facilities are all initially empty.  Your program should start execution using the special method {{public static void main(String\[\] args)}} which is the only vehicle for executing Java programs directly on the command line.
 (_DrJava_ has a {{main}} method for this reason.)

...

Your program executes a loop that repeatedly reads input from an input ``process'' "process" that returns Command objects. The input process (provided by our supporting
framework) reads a series of event description commands, one to a line, either from the console or from a file. The input process converts a stream of characters to {{Command }} objects which are passed to your program.
In addition to performing the specified common, your program should output a brief description of for each command that it performs in the exact format described below. In the following list of commands, the output line specifies what your program should print.

...

In response, the simulation outputs

Code Block
received <em>adjective</em> <em>article</em>adjective article

and updates the state of the StudentEnvironment .
For example,

...

means Acker misplaced the specified article of clothing.
If the item exists and Acker is not wearing it, the simulation outputs

Code Block
lost <em>adjective</em> <em>article</em>adjective article

and updates the state of the StudentEnvironment accordingly.

If Acker is wearing it, the simulation outputs

Code Block
Acker is wearing <em>adjective</em> <em>article</em>adjective article

and leaves the StudentEnvironment unchanged.

If the item does not exist, the simulation outputs

Code Block
<em>adjective</em> <em>article</em>adjective article does not exist

and leaves the StudentEnvironment unchanged.

...

means Acker doffed the specified article of clothing, discarding it in the dirty laundry pile, and donned a replacement article using the protocol described above.

In response, the simulation outputs

Code Block
doffed <em>adjective</em> <em>article</em>adjective article, donned <em>adjective</em> <em>article</em>adjective article

describing the article doffed and the article donned.

...

means Acker washed and dried a load of laundry.

If the dirty clothes pile is not empty, the simulation outputs

Code Block
washed <em>adjective</em> <em>article</em>adjective article, ..., <em>adjective</em> <em>article</em>adjective article

listing the clothes in the order they were removed from the dirty clothes pile.
If the dirty clothes pile is empty, the simulation outputs

...

means Acker retrieved a load of laundry, folded it, and put it on the closet shelf. If a load of laundry is available, the simulation outputs

Code Block
folded <em>adjective</em> <em>article</em>adjective article, ..., <em>adjective</em> <em>article</em>adjective article

for the oldest unfolded load.
List the clothes in the order they are placed on the shelf. Hence the top garment on the shelf should be the last one listed.
If no load of laundry has been washed and dried, then the simulation outputs

...

asks "what is Acker wearing?" The simulation outputs

Code Block
wearing <em>adjective</em>adjective shirt, <em>adjective</em>adjective pants, <em>adjective</em>adjective socks

Supporting Code and Programming Details

...