Project #2 Blue Ridge Shape Distributors – Bulk Data Input



14 February 2018 Project #2
COSC 051 Spring 2018 Page 1 of 6
Blue Ridge Shape Distributors – Bulk Data Input
Your application proved to be a great success and resulted in the Blue Ridge Shape Distributors (BRSD) senior
management approving the next phase of development.
Data validation procedures and computations remain much the same as they were before; however, now we are
required to process bulk data stored in input files. Regional sales representatives store their sales records in text
files. Before he retired, Ricky Bobby would have his assistant print these regional sales reports. After one look, he
could mentally tabulate the sales totals by product and region. Needless to say, there is no one else on the staff
with this skill! Our task is to develop an application that will read a sales file, perform calculations, and generate
summary output reports.
File Processing
Your software should prompt the user to enter the name and the path to the file containing sales data. Once that
information is entered, your software must open the file and process the input data. If the input file fails to open,
the software must output an error message indicating a problem occurred opening the file and a notice that
processing cannot continue.
If the file opens successfully, the software must read and process each line, or record, in the file. The first line of
the file contains the file date (this may, or may not match the actual calendar date). The second line of the file
contains column headings. These are for anyone reading the file manually. We will not use these column headings
and only need to read the entire line to “get it out of the way” and then move on to the third line. The third line of
the file is the first record of data that we will process. We will not know how many total records are in the file. We
simply must continue reading and processing lines of data until reaching the end of the input file. Each line of the
file contains the following data elements:
Data Validation
The system must test for a variety of possible data errors. You do not need to identify data type errors. That
means that if a number is expected, then you may assume that the input data file will have a number. If a string is
expected, you may assume the input data file will have a string, etc. The possibility of extraneous characters being
present in the data file does not apply. Once you have extracted the value of one data element from the file, you
may assume whatever is next is the value of the next data element.
State State abbreviation (a string, no spaces)
Region South, East, North, West, or Other (a string, no spaces)
Order Date Date order closed (string with format yyyy/mm/dd)
Shape Code Same codes as Project 1 (single character)
Material Code Same codes as Project 1 (single character)
Radius Radius of shape to fabricate (double)
Height Height of shape to fabricate (double)
Color Color of shape to fabricate (string, no spaces)
Customer Number Unique customer ID (string, no spaces)
First Name Customer’s first name (string, no spaces)
Last Name Customer’s last name (string, no spaces)
Address Customer’s mailing address (a string with spaces and punctuation)
14 February 2018 Project #2
COSC 051 Spring 2018 Page 2 of 6
As previously mentioned, if the input data file fails to open, then no calculations will be made, and no output will
be sent to the terminal screen. Otherwise, for this version of the project, validation errors will not cause the
processing to stop. If a data validation check fails, then no calculations will occur for that record. However, the
values of that row of data will be output along with a list of the errors that were identified (see the sample output
presented later). The table below lists several BRSD business rules (some from Project #1, some new) that apply to
data validation checks and other calculations. Data items not listed require no validation.
Data Item Validation Rule(s)
File Date Must follow format yyyy/mm/dd
Must be reasonable values (e.g. month between 1 and 12, day between 1 and 31)
NOTE: Test for valid file date values but take no action if the tests fail
Order Date Must follow format yyyy/mm/dd
Must be reasonable values (e.g. month between 1 and 12, day between 1 and 31)
Must be less than or equal to the File Date, sometimes sales representatives try to
slip in a future order to increase their quarterly performance numbers, the software
must identify this as an error
Shape Code Must be one of the valid values (See Project 1 Specs)
Material Code Must be one of the valid values (See Project 1 Specs)
radius (See Project 1 Specs)
height (See Project 1 Specs)
color Must be one of the valid values (Red, Orange, Yellow, Green, Blue, Indigo, and Violet)
IMPORTANT NOTES: When reading a date from the file, your software should separate the year, month, and
day values and store them in integer variables; this applies to the File Date at the beginning of the file and the
Order Date within each record. The year will always have four digits. With respect to the month, the format
“mm” means two digits for October, November, or December; but only one digit otherwise. The format “dd” for
the day means a single digit for the 1st through the 9th of the month and two digits otherwise.
Calculations and Output
If there are no errors, the software shall calculate the surface area, the volume, manufacturing costs and sales
price. A sample of this output is shown below. (Note that the rows of the sample output are not in the same order
as the input data file. Some rows have been removed to provide output containing a variety of different error
conditions). If a record contains errors, no calculations are made, and that record is eliminated from summary
report totals. However, details of that record will be output to the screen along with a brief message, or messages,
describing the error or errors.
In addition to this detailed output, a summary table shall be displayed on screen. This summary output should
contain the information and be formatted similar to the sample output.
14 February 2018 Project #2
COSC 051 Spring 2018 Page 3 of 6
Sample output from an execution of the program:
Region Date Codes Dimensions Color S. Area Cost Price Profit
North 2015/05/12 o c 16.00 16.80 Blue 1969.41 408.39 518.65 110.26
North 2015/03/08 y l 3.80 4.20 Orange 190.91 264.47 335.88 71.41
North 2015/02/02 p c 23.80 n/a Red 7114.49 1144.13 1453.05 308.92
North 2015/02/26 o l 17.20 20.00 Violet 2353.60 1529.65 1942.65 413.00

South 2015/02/28 p o 16.80 n/a Orange 3544.93 6116.77 7768.30 1651.53
South 2015/08/31 p o 5.00 n/a Juneberry
ERROR: order date is after file date.
ERROR: color is not valid.

East 2015/03/09 p c 18.30 n/a Indigo 4206.22 728.25 924.88 196.63
East 2015/05/19 o o 21.00 21.10 Yellow 3347.73 5794.33 7358.80 1564.47
East 2015/05/17 p l 21.00 n/a Indigo 5538.96 3393.08 4309.21 916.13
East 2015/05/13 y o 16.90 22.20 Blue 4149.76 7105.66 9024.19 1918.53
East 2015/08/08 y l 28.10 39.70 Red
ERROR: radius is outside of limits.
ERROR: height is outside of limits.

North 2015/08/23 y l 23.90 28.30 Red 7834.80 4736.15 6014.91 1278.76
North 2015/02/24 y c 3.00 3.00 Green 113.04 142.92 181.51 38.59
North 2015/05/14 p c 30.30 n/a Blue
ERROR: radius is outside of limits.
West 2015/07/19 y c 14.90 17.90 Violet 3069.16 565.65 718.38 152.73
West 2015/03/15 M c 22.30 22.60 Yellow
ERROR: shape code is not a valid value.
… West 2015/01/23 y V 21.90 22.60 Green
ERROR: material code is not a valid value.
Counts: Total Records = 2660 Records with Errors = 1088 Records without Errors = 1572
54 orders in the future.
Shape Number Cost Price Profit
Cone 506 831413.65 1055895.34 224481.69
Cylinder 540 1304855.38 1657166.33 352310.95
Sphere 526 1192268.18 1514180.59 321912.41
Average 524 1109512.40 1409080.75 299568.35
This line is optional
but strongly
14 February 2018 Project #2
COSC 051 Spring 2018 Page 4 of 6
Program Source Code
Important: Your output and input should be very similar to that shown in the sample output. Some content must
also be included in your program exactly as specified.
Academic Integrity
This is an individual project and all work must be your own. Refer to the guidelines specified in the Academic
Honesty section of this course syllabus or contact me if you have any questions.
Include the following comments at the start of your source code file:
* <netID>P2.cpp
* COSC 051
* Project #2
* Due on: 28 FEB 2018
* Author: <your name>
* In accordance with the class policies and Georgetown’s
* Honor Code, I certify that, with the exception of the
* class resources and those items noted below, I have neither
* given nor received any assistance on this project.
* References not otherwise commented within the program source code.
* Note that you should not mention any help from the TAs, the professor,
* or any code taken from the class textbooks.
These comments must appear exactly as shown above. The only difference will be values that you replace where
there are “place holders” within angle brackets such as <netID> which should be replaced by your own netID.
For example, I would replace <netID>P2.cpp with waw23P2.cpp.
Submission Details
Post to Blackboard a .cpp file containing your source code. Locate the assignment Project 2 on Blackboard
and attach/upload your file. Do not post your executable file. You should ensure that your source file compiles on
the server and that the executable file runs and produces the correct output. Use the following file name for your
file: <netID>P2.cpp. Due date for your code is no later than the end-of-day (11:59pm) on February 28th. Late
submissions will be penalized 2.5% for each 15-minutes late. If you are over 10 hours late you may turn in the
project to receive feedback but the grade will be zero. In general requests for extensions will not be considered.
The value for this project is 100 points.
14 February 2018 Project #2
COSC 051 Spring 2018 Page 5 of 6
How to approach this program
For this project several milestones are provided. You are NOT required to turn anything in or to meet these
milestones. Make sure that your code compiles and runs prior to moving on to the next milestone.
Milestone 1 – NLT February 16th
• Create an empty source code file; insert heading comments (copy and paste from Blackboard, edit as
applicable), add preprocessor directives, add using namespace std;
• Add a “skeleton” of function main()
• Add global constants that you will reuse from Project 1
• Add data input prompt statement and input statement for the path/filename of the data file
• Add variable declarations and initializations that you will reuse from Project 1
• Compile and run after each addition
Milestone 2 – NLT February 19th
• Add code to open the data file and test for success, if the file fails to open output an error message but do
not attempt to read the file, if the file does open it is good to also output a “success” message
• Add a loop to read each line of the file, this is just a test, read the entire line into one string and then
output that string to the terminal, once all records have been read, close the file
Milestone 3 – NLT February 22nd
• Now, add code to read each line, but extract the individual data fields in the correct variables
• Add data validation code (much of this can be copied from the previous project)
• Add detailed output code, includes values from each row read from the file, and error messages for any
records that did not pass validation
• Add code to calculate surface area, volume, and cost figures (reuse as much as you can from Project 1)
Milestone 4 – NLT February 25th
• Add code to keep running totals and calculate summary statistics
• Add formatted summary output
Milestone 5 – NLT February 28th
• Fine tune calculations and output
• Ensure program compiles and runs on the server
• Turn-in code… on time
Programming Skills
The programming skills required to complete this assignment include:
• Screen output (cout)
• Keyboard input (cin)
• Basic data validation
• Basic output formatting
• Basic calculations
• File input/output
• Control structures for repetition
• Advanced output formatting
• Tabulated output
• Advanced data validation
14 February 2018 Project #2
COSC 051 Spring 2018 Page 6 of 6
Grade Rubric
Detailed Rubric 100.00 <– TOTAL
1 Code Quality and Formatting 14.00 <–sub total
proper indentation
good variable and constant names
good use of constants (no “magic numbers” in calculations)
good use of comments
good use of vertical white space to separate code
good use of horizontal white space to improve readability
line length less than 100 characters
2 User interface / data input 15.00 <–sub total
outputs a brief greeting message
outputs prompt for complete path and file name for input data file
file name and path are stored in string variable
input data file is opened and tested, if file fails to open an error message is displayed and
the program gracefully terminates (no abnormal exit)
if the file successfully opens, then all data rows are processed and the values of each row are
extracted into appropriate variables
dates are correctly parsed into year, month, and day components and stored in integer variables
all rows of the file are read, and then the file is closed
3 Data validation algorithms 23.00 <–sub total
input data are validated to ensure they are valid and/or within limits (see validation table on
page 2 of the project description for details, input data not in that table do not require
if any input data fail validation, values for that record are displayed on screen along with
error message(s) that clearly indicate which data elements failed validation
the only “fatal” error is an error opening the input data file, in which case the program must
gracefully terminate
for all “non-fatal” data validation errors, processing shall continue, but if a row contains one
or more errors, then that row of data is eliminated from calculations
check the month and day of the file date, but ignore any errors (the date in the test file
provided is valid and any other test data used by the graders will have a valid file date)
4 Calculation algorithms 23.00 <–sub total
only make these calculations for records that pass the validation checks
surface area, volume, cost, price, and profit values are accurately computed
summary statistics shall be calculated: count of each shape; running totals for manufacturing
cost, sales price, and profit for each shape are accurately maintained
optional: count of records with errors, count of records without errors
5 Output 25.00 <–sub total
for records that contain errors (failed validation checks), output the region, date, shape code,
material code, radius, height, and color; below those values also output brief messages that
state the nature of each error (see the sample output in project description and the sample
executable for more details of the output format)
for records that are error free (pass all validation checks) also output the surface area, cost,
price and profit (see sample output in project description and the example program for more
details of the output format)
output a summary table that includes the count of each shape and the final value of running
totals for cost, price, and profit (see the sample output in project description and the example
program for more details of the output format)
output is neatly arranged on screen and is consistent with the sample output in the project
description and the output shown in the example program
Common Deductions
Program does not compile ON THE CLASS SERVER (deduction varies depending on how bad, value listed is max) -50.00
Program compiles but has warnings ON THE CLASS SERVER (deduction varies depending on how bad, value listed is max) -30.00
Program crashes during execution ON THE CLASS SERVER (deduction varies depending on how bad, value listed is max) -40.00
Code uses any abnormal exits -40.00
Code uses any global variables -40.00
Filename does not follow conventions specified -30.00
Required comments and honor statement not included at start of file exactly as specified -50.00
Late penalty for each 15 minutes late -2.50
Grade Standards – Missing: 0%, Poor: up to 50%, Fair: up to 67%, Good: up to 82%, Excellent: up to 99%, Perfect: 100%


There are no reviews yet.

Be the first to review “Project #2 Blue Ridge Shape Distributors – Bulk Data Input”

Your email address will not be published.