CS 31: Introduction to Computer Science I:
Project 6 Skeleton
// UCLA Winter 2010
// CS 31 Project 6:
Object Oriented Tape Player:
// John A. Rohr
// March 2, 2010
// This program simulates the operation of a tape player.
// The tape player has three states:
stopped, moving forward, and moving backward.
// When the tape is moving, it can be moving at the play speed, faster, or slower.
// The tape player includes the transport mechanism that holds the tape reels,
// function buttons to control the operation, and a display to show the status
// of the player at each increment of time.
// At the beginning of the program, the length of the tape must be specified.
// The length is specified in feet.
The normal play speed of the tape player
// is 2.56 inches per second.
// There are six function buttons:
play forward, play backward, faster, slower,
// rewind, and stop.
Each time a faster button is pressed, the tape speed is
// doubled up to a preset maximum speed.
Each time the slower button is pushed,
// the tape speed is reduced by one half until a preset minimum speed is reached.
// The rewind button moves the tape backward at the maximum speed.
// The display shows the current tape motion, speed, and position as well as
// the percentage of tape used and the speed step and ratio to normal play speed.
// The program begins with initialization and input of the tape length.
// The program then prompts for and waits for commands.
Four kinds of commands
// are available:
display the menu of commands, push a function button, advance
// a specified number of seconds, and quit.
Commands may be entered in either
// upper case or lower case.
Command words may be any length, but only the first
// letter of a command is used.
The A command advances the simulation by a
// specified number of seconds.
White space must separate the command letter
// or word and the number of seconds.
If no value is given or the value given
// is invalid (not terminated by white space or the end of the line), an
// increment of one is used.
// Each time a valid command is entered, it is executed, the tape player status
// is displayed, and, if the command is not quit, the program then prompts for
// and waits for the next command.
// When the quit command is executed, operation of the tape player is terminated,
// final status is displayed, and program execution is terminated.
// Following is the menu of commands available in the program: