SOLUTION_6

SOLUTION_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 2009: Project 6 Solution Page 1 // UCLA Winter 2009 // CS 31 Project 6: Classes // John A. Rohr // February 28, 2009 // // // This project simulates the operation of a store. // // The project includes capabilities to add to the store stock, sell store // items, list the store inventory, and list items that need reordering. // // The initial store stock is specified on a separate input file. Each line // specifies a stock number followed by a cost followed by an initial count // followed by a reorder threshhold followed by a description of the item. // All numbers are integers. The description consists of all the characters // on the line following the white space after the reorder threshhold. // Comments and blank lines the are allowed in the initial stock file // are displayed but otherwise ignored. Comment lines begin with an // asterisk ('*') in the first character position of the line. // // User input to the program consists of buy orders and restock orders. // Input for both consists of a stock number followed by a quantity. // Prompts are issued for both inputs as well as for continuation unless // the maximum number of items that can be ordered or restocked has been // input. No empty lines or comment lines are allowed in the orders. // // A title followed by a blank line is displayed at the beginning and // a blank line and a termination message at the end. // // All numerical data and computation is integer only. // // All strings are C++ Strings. // // The getline function in the string class is used to read input lines. // Each input line is read into a single C++ String. // // Each output line is written as a single C++ String with one endline. // // All initial stock data is on the file InitialStock.In. // // All buy order and restock order input is read from the file File6.In // if it can be opened. Otherwise all buy order and restock order input // is read from the keyboard. Order generation is terminated by entering // a nonblank line when prompted for continuation. // // All output is written to the console and the file File6.Out if it can be // opened. Otherwise all output is written to the console only. // // A function is included to double the size of the inventory items table.
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 2009: Project 6 Solution Page 2 #include <iostream> #include <fstream> #include <iomanip> #include <string> using namespace std; // ************************************************************************** // * * // * GLOBAL CONSTANTS * // * * // ************************************************************************** const int INITIAL_ITEMS = 1; const int MAX_LIST = 10; const string STOCK_FILE_NAME = "InitialStock.In"; const string
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 / 46

SOLUTION_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