{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Thorndale};}{\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}
{\f28\froman\fcharset238\fprq2 Times New Roman CE{\*\falt Thorndale};}{\f29\froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Thorndale};}{\f31\froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Thorndale};}
{\f32\froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Thorndale};}{\f33\froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Thorndale};}{\f34\froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Thorndale};}
{\f35\froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Thorndale};}{\f44\fmodern\fcharset238\fprq1 Courier New CE;}{\f45\fmodern\fcharset204\fprq1 Courier New Cyr;}{\f47\fmodern\fcharset161\fprq1 Courier New Greek;}
{\f48\fmodern\fcharset162\fprq1 Courier New Tur;}{\f49\fmodern\fcharset177\fprq1 Courier New (Hebrew);}{\f50\fmodern\fcharset178\fprq1 Courier New (Arabic);}{\f51\fmodern\fcharset186\fprq1 Courier New Baltic;}}{\colortbl;\red0\green0\blue0;
\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 \fs24\cf1\lang1033\langfe255\cgrid\langnp1033\langfenp255 \snext0 Normal;}{
\s1\ql \li0\ri0\sb240\sa60\keepn\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 \b\fs28\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon15 \snext15 heading 1;}{\s2\ql \li0\ri0\keepn\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 
\b\fs20\cf1\lang1033\langfe255\cgrid\langnp1033\langfenp255 \sbasedon0 \snext0 heading 2;}{\*\cs10 \additive Default Paragraph Font;}{\s15\ql \li0\ri0\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 
\snext15 Default;}{\s16\ql \li0\ri0\sa120\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon15 \snext16 Text body;}{\s17\ql \fi-283\li567\ri0\sa120\nowidctlpar
\tx567\aspalpha\faauto\rin0\lin567\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon16 \snext17 Hanging indent;}{\s18\ql \li0\ri0\sb240\sa120\keepn\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 
\fs28\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon15 \snext16 Heading;}{\s19\ql \fi-360\li360\ri0\nowidctlpar\aspalpha\faauto\rin0\lin360\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon15 \snext19 List;}{
\s20\ql \fi-360\li720\ri0\nowidctlpar\aspalpha\faauto\rin0\lin720\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon15 \snext20 List 2;}{\s21\ql \li0\ri0\nowidctlpar\tqc\tx4320\tqr\tx8640\aspalpha\faauto\rin0\lin0\itap0 
\fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon15 \snext21 header;}{\s22\ql \li0\ri0\sa120\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon16 \snext22 Table Contents;}{
\s23\qc \li0\ri0\sa120\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 \b\i\fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon22 \snext23 Table Heading;}{\s24\ql \li0\ri0\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 
\fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon15 \snext24 Index;}{\s25\qc \li0\ri0\sb240\sa60\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 \b\fs32\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon15 \snext26 Title;}{
\s26\qc \li0\ri0\sa60\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon15 \snext16 Subtitle;}{\s27\ql \li0\ri0\nowidctlpar\tqc\tx4320\tqr\tx8640\aspalpha\faauto\rin0\lin0\itap0 
\fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon15 \snext27 footer;}{\s28\ql \li0\ri0\sb120\sa120\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 \i\fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon15 \snext28 caption;}{\*
\cs29 \additive \cf1\lang0\langfe255\langfenp255 Numbering Symbols;}{\*\cs30 \additive \cf1\lang0\langfe255\langfenp255 WW-Default Paragraph Font;}{\*\cs31 \additive \cf1\lang0\langfe255\langfenp255 \sbasedon30 page number;}}{\info{\author CNRS}
{\operator CNRS}{\creatim\yr2003\mo8\dy29\hr23\min17}{\revtim\yr2003\mo10\dy17\hr9\min45}{\printim\yr2003\mo10\dy10\hr9\min12}{\version4}{\edmins6}{\nofpages3}{\nofwords1050}{\nofchars5987}{\*\company CNRS-HSU}{\nofcharsws7352}{\vern8269}}
\margl1440\margr1440\margt1400\margb720 \widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\nolnhtadjtbl 
\fet0\sectd \sbknone\linex0\headery709\sectdefaultcl {\header \pard\plain \s21\ql \li0\ri0\nowidctlpar\tqc\tx4320\tqr\tx8640\aspalpha\faauto\rin0\lin0\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\fs16 CS 131 - Homework #6\tab \tab p. }
{\field{\*\fldinst {\fs16 \\page}}{\fldrslt {\fs16\lang1024\langfe1024\noproof 3}}}{
\par }{\fs16 Fall 2003
\par }}{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}
{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8
\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \s15\qc \li0\ri0\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 
\fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\b CS 131 - Intro to Computer Science I - Fall 2003
\par LAB #7 EXERCISE and Homework #7
\par 
\par lab #7 exercise due: Friday, October 17th, END of lab
\par HW #7 due: Friday, October 24th, }{\b\ul beginning}{\b  of lab
\par }\pard \s15\ql \li0\ri0\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 {\b 
\par }{
You are to work individually on this assignment, and you will turn in the specified files by e-mail (one file per e-mail message, with the contents included in the text and not as an attachment, and with a copy CC'd to yourself as your receipt) as you did
 for 131 HW #6.
\par }{\b 
\par }{\b\ul LAB #7 EXERCISE
\par }\pard \s15\ql \fi-435\li420\ri0\nowidctlpar\aspalpha\faauto\rin0\lin420\itap0 {*\tab Do Homework Problem #1 below.
\par 
\par *\tab When you are done, add your name to the "Next:" list on the board.
\par }{\b 
\par }{*\tab When it is your turn, I will come and verify that you have created a}{\b  Prof.cpp}{, and that}{\b  testProf }{indeed works using it --- once I have confirmed this, you have successfully completed today's lab exercise.
\par }{\b 
\par }{The above must be completed before lab is over, of course.
\par }\pard \s15\ql \li0\ri0\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 {\b 
\par }{\b\ul HOMEWORK #7:
\par }{\b 
\par }\pard \s15\ql \fi-435\li420\ri0\nowidctlpar\aspalpha\faauto\rin0\lin420\itap0 {\b 1.\tab }{Remember how }{\b Prof.h}{, }{\b Prof.o}{, and }{\b testProf.cpp}{ were provided as part of HW #6? Now, try your hand at writing your own }{\b Prof.cpp}{.}{\b 

\par 
\par \tab }{Once you have written it, you should:
\par }\pard \s15\ql \fi-435\li855\ri0\nowidctlpar\aspalpha\faauto\rin0\lin855\itap0 {*\tab }{\b compile }{it, so that it can overwrite the}{\b  Prof.o }{that you copied for HW #6:
\par }{\b \tab }{\f2 g++ -c Prof.cpp}{
\par }{\b\loch\af2 
\par }{*\tab }{\b re-compile }{testProf.cpp, so that you can run it using}{\b  your }{Prof.o file:
\par }{\b \tab }{\f2 g++ -o testProf testProf.cpp Prof.o}{
\par }{\b\loch\af2 
\par }{*}{\b \tab re-run }{the resulting executable testProf, to test your implementation of Prof.cpp:
\par }{\b \tab }{\f2 testProf}{
\par }{
\par }\pard \s15\ql \fi-435\li420\ri0\nowidctlpar\aspalpha\faauto\rin0\lin420\itap0 {\b \tab }{If testProf runs as you expect, then you are now ready to put your name on the board (for the Lab Exercise #7).
\par }{\b 
\par \tab }{Don't mail}{\b  Prof.cpp }{to me yet, however --- you will instead mail me the version of}{\b  Prof.cpp}{ that results after completing both Problem #1 and Problem #3.}{\b 
\par 
\par 2.\tab }{You will probably not be shocked to hear that I would also like you to implement }{\b Point3.cpp}{. (Just in case you need or would like them, example versions of }{\b Point3.h}{ and }{\b testPoint3.cpp}{
 will appear on the course Blackboard site at 1:05 on Friday, October 17th, under  }{\b Some Solutions}{ .)}{\b 
\par 
\par }{\tab As for problem #1, once you have written }{\b Point3.cpp}{, you need to compile it, recompile }{\b testPoint3.cpp}{, and then re-run }{\b testPoint3}{ to test/exercise your implementation of }{\b Point3.cpp}{.}{\b 
\par 
\par \tab }{E-mail to me your resulting}{\b  Point3.cpp. 
\par 
\par 3.\tab }{Twist #1: remember how we wrote }{\b alphaForm2.cpp}{ and }{\b mailingForm.cpp}{ for HW #6? Those were functions }{\b separate}{ from }{\b Prof}{, that took a single Prof instance as its single }{\b argument}{. }{\b 
\par 
\par \tab }{What if we instead decided that those were handy functions that we'd like to have as}{\b  public member functions }{of class}{\b  Prof}{? Call them}{\b  alphaName }{and}{\b  mailingName}{, so we won't confuse
 these public member functions with those earlier outside functions.
\par }{\b 
\par \tab }{Well, they'd no longer take a Prof argument --- both would, like the accessor functions such as get_lastName and get_firstName, etc., take}{\b  }{no argument, but they'd still return a string 
(the same kinds of string their separate-function-versions returned in HW #6). In their implementations --- how would you access the}{\b  }{
associated Prof's data fields? Well, look at how accessor functions access the data fields of their calling instance...
\par }{\b 
\par \tab }{Modify}{\b  Prof.h }{to now include these two new public member functions,}{\b  alphaName }{and}{\b  mailingName}{. Also modify your }{\b Prof.}{cppfrom problem #1 to include implementations of these new public member functions, and modify}{\b 
 testProf.cpp }{to test them. (}{\b testProf.cpp }{is rather wimpy as a tester, but I'll let you simply add tests for the new member functions analogous to the rather wimpy ones currently there.)
\par }{\b 
\par \tab }{Email to me your resulting}{\b  Prof.h, Prof.cpp, }{and}{\b  testProf.cpp.
\par 
\par 4.\tab }{Consider the }{\b Dice}{ class discussed in lecture. 
We have decided that we'd like this Dice instance to also keep track of what value is currently "showing" on the dice instance. If the dice instance has never been rolled, it should be considered to have a value-showing of }{\b 0}{
 --- that way, you can easily tell if a dice instance has never been rolled. When it is rolled, the value-showing should change to the value of that roll (and the value-showing should remain as that value until the next roll).}{\b 
\par 
\par \tab }{Consider what we have discussed about "good" object style, so far. How should  this additional feature be implemented within}{\b  Dice.h }{and}{\b  Dice.cpp}{
? I will be looking for good style/good practice in what you decide is needed. You should also modify the "nicer" test}{\b  testDice.cpp }{
from the "In-class examples" part of the course web page, so that it reflects appropriate tests for this new feature.
\par }{\b 
\par \tab }{Email to me your resulting}{\b  Dice.h, Dice.cpp, }{and}{\b  testDice.cpp.
\par 
\par 5.\tab }{Write a program (with its main function's source code in a file named }{\b repeatWord.cpp}{) that asks the user for a word to repeat, and then how many times they would like to see that word repeated. Then...}{\b 
\par 
\par \tab for HALF credit: }{the program simply prints that word that many times, once per line, using an appropriate }{\b for}{-loop. That is, here is an example program dialog (what the program is printing is in boldface):}{\b 
\par 
\par \tab }{\b\f2 Enter word to repeat: }{\f2 george}{\b 
\par }{\b\loch\af2 \tab \hich\af0\dbch\af0\loch\f2 Repeat how many times? }{\loch\af2 \hich\af0\dbch\af0\loch\f2 6}{\b\loch\af2 
\par \tab \hich\af0\dbch\af0\loch\f2 george
\par \tab \hich\af0\dbch\af0\loch\f2 george
\par \tab \hich\af0\dbch\af0\loch\f2 george
\par \tab \hich\af0\dbch\af0\loch\f2 george
\par \tab \hich\af0\dbch\af0\loch\f2 george
\par \tab \hich\af0\dbch\af0\loch\f2 george
\par \hich\af0\dbch\af0\loch\f2     
\par \tab }{\b for FULL credit: }{the program still uses an appropriate}{\b  for}{
-loop to print that word that many times --- BUT it ALSO follows the word on each line with the same number of exclamation points as the number of times it is being repeated. (It shou
ld use the most appropriate means for accomplishing this...) That is, here is an example program:}{\loch\af2 
\par }{\b 
\par \tab }{\b\f2 Enter word to repeat: }{\f2 george}{\b 
\par }{\b\loch\af2 \tab \hich\af0\dbch\af0\loch\f2 Repeat how many times? }{\loch\af2 \hich\af0\dbch\af0\loch\f2 6}{\b\loch\af2 
\par \tab \hich\af0\dbch\af0\loch\f2 george!!!!!!
\par \tab \hich\af0\dbch\af0\loch\f2 george!!!!!!
\par \tab \hich\af0\dbch\af0\loch\f2 george!!!!!!
\par \tab \hich\af0\dbch\af0\loch\f2 george!!!!!!
\par \tab \hich\af0\dbch\af0\loch\f2 george!!!!!!
\par \tab \hich\af0\dbch\af0\loch\f2 george!!!!!!
\par 
\par \tab }{Tips for full-credit version: think carefully about what needs to be done, in what order, and what is actually being repeated and when. And make sure that your loop-control variables do not, ah, clash...}{\b\loch\af2 
\par }{\b 
\par \tab }{Email to me your resulting}{\b  repeatWord.cpp}{.}{\b 
\par 
\par 6.\tab }{Consider }{\b testDice.cpp}{ --- amongst its tests, it includes rolling a dice with a specified number of sides a specified number of times. }{\b 
\par 
\par \tab }{When you are doing something repeatedly, you can also}{\b  accumulate }{information during that repetition, to be used after the loop is complete. For example, you could have a local}{\b  sum }{
variable set to 0 before a loop starts, and you could add}{\b  to }{sum the value of the roll each time within the loop, and then, after the loop,}{\b  sum }{would contain the total sum of all of the rolls of the dice during that loop, wouldn't it?
\par }{\b 
\par \tab }{Let's try it. Write a main function (in a file named}{\b  sumAndAvg.cpp}{) that uses class}{\b  Dice }{and that will ask a user to specify how many sides they'd like on a die, and how many times they'd like to roll it. It should th
en roll the die that many times (using an appropriate}{\b  for}{-loop)
, printing its value to the screen (along with which number of roll this is) for each roll. BUT, when done with all of the dice-rolling, it should ALSO report the SUM of all of those rolls, and
 the AVG roll (that is, compute the average roll for all of those rolls), taking care to print this average to precisely }{\b THREE}{\b  fractional places.
\par 
\par }{\tab Email to me your resulting }{\b sumAndAvg.cpp}{.}{\b 
\par 
\par }\pard \s15\ql \fi-15\li0\ri0\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 {\tab Throughout the homework, IF you create any helper functions, be sure to e-mail them to me along with your other homework files.
\par }\pard \s15\ql \fi-435\li420\ri0\nowidctlpar\aspalpha\faauto\rin0\lin420\itap0 {
\par }\pard \s15\ql \li-15\ri0\nowidctlpar\aspalpha\faauto\rin0\lin-15\itap0 {Remember --- when you are done with this homework, you should have sent me at least 9 e-mail messages, one each for }{\b Point3.cpp}{,  }{\b Prof.h}{, }{\b Prof.cpp}{, }{\b 
testProf.cpp}{, }{\b  Dice.h, Dice.cpp}{,  }{\b testDice.cpp}{, }{\b  repeatWord.cpp}{, and }{\b sumAndAvg.cpp}{. 
\par 
\par 
\par }{\b 
\par }{
\par }\pard \s15\ql \fi-435\li435\ri0\nowidctlpar\aspalpha\faauto\rin0\lin435\itap0 {
\par }}