[Skip Navigation] [CSUSB] / [CNS] / [CSE] / [R J Botting] >> [CSE201] >> [Lab01] >> index
[Index] [Schedule] [Syllabi] [Glossary] [Labs] [Projects] [Resources] [Grading] [Search ]
Notes: [01] [02] [03] [04] [05] [06] [07] [08] [09] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]
Labs: [01] [02] [03] [04] [05] [06] [07] [08] [09] [10]
Tue Feb 7 12:49:05 PST 2012

Contents


    CSci201 Laboratory 07 -- Classes

      Previous [ ../lab06/ ] Next [ ../lab08/ ]

      Note

      You can do this lab using a graphic editor or in a terminal using vi as you wish.

      Set up

      Login. Change directory to cs201.

      Make a new directory lab07 and change directory to it.

      Perform all the exercises in this lab under this directory.

      Download these programs

      [ test.Counter.cpp ] [ test.Circle.cpp ]

      Experiment 1

      Try to compile and run "test.Counter.cpp". Does it work? Does it fail? If so, fix it!

      Experiment 2

      Add a new function to the Count class and add statements that test it.

      The header for the function is

       		void setValue(int v); // sets value to v
      and a suitable test is
       		c.setValue(5);
       		assert(c.getValue() == 5 );

      Add any other test you like... then add the function definition

       		void Counter::setValue(.....){....}
      (fill in the blanks) and make it work.

      Experiment 3

      Try to compile and run "test.Circle.cpp". Does it work? You will need a calculator -- our machines have one: Activities -> Applications -> Accessories -> Calculator, or you can use Google in your browser!

      How does it fail? Fix it (the error is subtle, be thoughtful)!

      Get credit

      Finish all the experiments and get an a A.

      Work on your project

    . . . . . . . . . ( end of section CSci201 Laboratory 07 -- Classes) <<Contents | End>>

    Abreviations

  1. Gnu::="Gnu's Not Unix", a long running open source project that supplies a very popular C++ compiler.
  2. TBA::="To Be Announced", something I have to do.
  3. TBD::="To Be Done", something you have to do.

End