CS 24, Fall 2016
Programming Assignment 1
Due: Friday, October 7, 11:59pm
Worth: 100 points
PA1 must be done individually - each student must accomplish it alone and submit it. Later
assignments may allow students to work in pairs (see course
policies), but not this assignment.
- Complete stats.cxx to implement class statistician as it is defined
in the stats.h header file. This assignment is based on Chapter 2,
Programming Project 2 (here is a local copy of page 90, in case
your printing of the text is one for which this page is not yet corrected). Follow the
instructions on this web page, not the ones on page 90 - but do see the hints provided
by the textbook author.
- Type your name and the date in a comment at the top.
[Like always, whether or not we remind you!]
- Implement the constructor, all five remaining member functions (sum and length
are implemented inline in stats.h), and all three
non-member functions (including the two friends) as they are declared in stats.h.
Read the documentation for
each of these functions at the top of stats.h, and make sure your implementations
work as advertised in those comments - i.e., satisfy all of the postconditions.
- Use assert to verify the pre-conditions of functions mean, minimum and maximum.
- Here is a discussion with hints and FAQs about the
assignment from its primary creator, Michael Main (one of our textbook's authors).
- Compile and test your program at CSIL (by connecting remotely is okay). Use
this interactive test program: stattest.cxx (download
to your working directory for this project). Here is the quickest way to compile it
along with your stats.cxx, and link them together to an executable named stattest:
g++ -o stattest stattest.cxx stats.cxx
The point of this interactive test program is for you to test your functions individually,
to make sure each one is working properly before running your implementation through
more comprehensive tests like the ones that will be used when you submit.
To learn details of those tests, see the non-interactive test program we will
use: statexam.cxx (you can try it out before
submitting if you want - give a test number, 1 to 5, as a command line argument if you run it).
Do not proceed to the next step to submit your work until you are sure that all of your
functions are working properly.
- Submit PA1 at https://submit.cs.ucsb.edu/, or
use the following command from a CS terminal:
~submit/submit -p 525 stats.cxx
Be sure to wait for the results of all tests. If you score 100/100, and you've
followed all of the other rules, then you'll earn full credit.
Prepared 9/23/2016 by Michael Costanzo
Special thanks to Michael Main, University of Colorado, creator of most parts of this project.