copyright Steve J. Hodges   http://steveh.net/cs19/cs19-hw05.html

CS19 Fall 2014

Assignment 5 (Splat the Schmoo)

Directory Name

19-5

Resulting Executable

p5

Resources

A sample input textfile (matching) output file

Background

This is a new Schmoo game. Schmoos are imaginary creatures who love being splatted with juicy mud balls. You, being a Schmoo lover, try to make Schmoos happy by tossing mud balls at them.1

Create a class named Schmoo. Your Schmoo class needs to have two doubles (x and y) which represent the location of the Schmoo (in feet.) Note that x and y can be positive or negative. Your Schmoo class also needs an int (mud), initally 0, that tells you how many times that Schmoo has been hit with mud. (A mud ball will hit a Schmoo if it lands within 5 feet of the Schmoo.) Your Schmoo should have an output function that displays the coordinates of the Schmoo as well as the number of times that the Schmoo has been hit with mud (see the provided sample for the required format.) Since Schmoos only like people who throw mud at them, your Schmoo class should not use the friend class feature. Your Schmoo class should have a Copy Constructor.

Create a Linked List class named SchmooList, and a link node class named Linknode. (This will be a customized Linked List (special features described below) based on the 3-class Linked List as described in class.)

Program Description

Your program will read its input from STDIN and write its output to STDOUT. A sample input file and resulting output will be provided. After you have completed reading the input, Your program should print a two line header (name, pengo, email, etc.), then print the number of Schmoos in the list and then call the list printAll() function. The input file will consist of a list of commands, one per line. There are three different commands, and each will consist of two words followed by two doubles. The commands are "add schmoo", "throw mud", "remove schmoo". You must check for the commands in a case-insensitive manner. The three commands should call your insertFront(), ThrowMudAt(), and RemoveAt() functions respectively.

The SchmooList class must support at a minimum, the following functions:



1. From The Best of Creative Computing Magazine, Volume One, Edited by David H. Ahl, Creative Computing Press, 1976