SKELETON_6 - CS 31: Introduction to Computer Science I: / /...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 31: Introduction to Computer Science I: Winter 2010: Project 6 Skeleton Page 1 // UCLA Winter 2010 // CS 31 Project 6: Object Oriented Tape Player: Skeleton Code // 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: // // Key Function // P Play forward // B Play backward // + Increase speed // - Decrease speed // R Rewind // S Stop tape // A Advance simulation // M Display menu // Q Quit simulation
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS 31: Introduction to Computer Science I: Winter 2010: Project 6 Skeleton Page 2 //#define ECHO #include <iostream> #include <string> using namespace std; // ******************************************************************************** // * * // * GLOBAL CONSTANTS * // * * // ******************************************************************************** const int
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 43

SKELETON_6 - CS 31: Introduction to Computer Science I: / /...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online