pa01 : Statistician as a C++ Abstract Data Type (ADT)

num ready? description assigned due
pa01 true Statistician as a C++ Abstract Data Type (ADT) Tue 04/11 09:00AM Mon 04/17 11:59PM

PA1 must be done individually - each student must accomplish it alone and submit it. Later assignments may allow students to work in pairs , but not this assignment.

Create a pa01 directory and obtain the starter code

  • Create a directory names pa1 in your cs24 directory on CSIL.

  • Change into that directory and obtain the starter code by typing the following command

cp ~/cs24/starter-code/pa01/* ./

Assignment instructions

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 the interactive test program: stattest.cxx. 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 694 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.