This lab will give you hands on experience in implementing a class, demonstrating many of the concepts covered in chapter 2 of the text.
makefilefrom the directory
lab1subdirectory. For example, if you are in your lab1 subdirectory,
% cp /usr/local/apache2/htdocs/u/cs/rt/cs2440_sm04/labs/lab1/stat*.* .will copy
stats.ois the pre-compiled object code for a functioning version of the statistician class and
makefileis a file you can use to help build your programs.
% g++ -Wall statexam.C stats.o -o statexamRun the program to see what it does. After you write your own version of
stats.C, this is the output you want to see.
stattestprogram by doing the following:
% g++ -Wall stattest.C stats.o -o stattestRun the program to see what it does. Do some of the commands given in the menu to see how the statistician is supposed to work. You will use your version of
stats.Cwith this program to help in debugging your version. Answer the following questions using the program (these will help you understand the behavior of a statistician object):
% g++ -Wall main.C stats.o -o mainNote that to use the statistician class, you just need the following in main.C
#include "stats.h" using namespace main_savitch_2C;
stats.C. Make a copy of
% cp stats.h stats.CTo begin transforming
stats.Cinto the implementation file, edit it by deleting the class definition, and put stubs in for each member function. Use the documentation already provided as the documentation for each function. At this stage you should have a
stats.Cfile that will compile and run with any of the programs compiled earlier (statexam, stattest, or main). Of course, with stubs nothing will work correctly yet. Implement one member function at a time, compiling and testing each one before moving on to the next one.
For more discussion of the statistician class, click here
stats.Cyou may find it helpful to start using the
To build either your statexam, stattest, main, you can type:
make stattest make statexam make main
You are not required to use the makefile or understand what it is doing. We'll be using makefiles more extensively in the future, however. For more reading on makefiles, see a make tutorial
stats.Cby the due date in your lab1 directory. Leave a readme file fi you need to explain something on compilation.