\documentstyle[html]{article}
\setlength{\textwidth}{6.6truein}
\setlength{\oddsidemargin}{-.2truein}
\setlength{\evensidemargin}{-.2truein}
\setlength{\textheight}{9truein}
\setlength{\topmargin}{-.4truein}
\setlength{\headsep}{.2truein}
\setlength{\footskip}{.3truein}
\begin{document}

\begin{center}
  {\Large \bf Final Program} \\
  \strut \\
  {Group:\ \hrulefill
   \ \ \ \ Captain:\ \hrulefill\hrulefill\hrulefill
   \ \ \ \ Recorder:\ \hrulefill\hrulefill\hrulefill
   \ \ \ \ Reflector:\ \hrulefill\hrulefill\hrulefill}
\end{center}

\begin{description}

\item[Motivation] \strut\hfill \\

  An important objective is to learn the skills that will allow you to
  learn more about C++ (or any other programming language, even ones
  not yet devised!) on your own. "Life-long learner" sums it up.

  Learning to learn is essential to make you into an engineer who can
  stay up-to-date throughout your long carreer.

\item[Objectives] \strut

  \begin{enumerate}
  \item Learn to learn.
  \item Improve program neatness.
  \item Strengthen previous knowledge.
  \end{enumerate}

\item[Performance Criteria]  \strut

  \begin{enumerate}

  \item Your success in converting the part object of your program
    into an array of such objects.  Your success in modifying your
    program so that you can enter all your parts of your Sterling
    engine into the entries of this array.  Your success in printing
    out a list of the entered Stirling engine parts when the program
    exits and E-mailing the list and program to the instructor. (50\%)

    {\em Hint:} Start with a small number of parts, say the sockethead
    cap screw, (all steel, no brass), flywheel (all brass, no steel),
    and displacer cylinder (all steel.)

    {\em Hint:} You will need an index for your array of part objects.
    You may want to call that index \verb^part_index^.  Initialize
    \verb^part_index^ to -1.  Then each time the user selects 'P' to
    add a new part, increment \verb^part_index^ by one.

    {\em Hint:} After the \verb^while^, you will want to use a
    variable, say \verb^number_of_parts^, to hold the total number of
    parts that the user has defined.

  \item Make at least two significant improvements (of your own
    choice) to the program.  You can do whatever you want.  But
    neatness improvements do not count. (Neatness is counted
    separately, see below.) (Each 10\%).

  \item The neatness, clarity, and simplicity of your final programs.
    (30\%).

  \end{enumerate}

\item[Resources]  \strut

  \begin{enumerate}
  \item Your creativity.
  \item Your knowledge of C++.
  \item The course web page.
  \item The textbook.
  \item The instructor.
  \item The TA.
  \item The online help facilities of Windows, Netscape or Internet
    Explorer, and the C++ compiler.
  \end{enumerate}

\item[Plan]  \strut

  \begin{enumerate}
  \item Do the first program.  Test throroughly and check for
    neatness.  Mail program and produced parts table to the
    instructor.
  \item Brainstorm with your group what can be improved in your
    program. Make the improvements.  Mail to the instructor.
  \end{enumerate}

\item[Exercises]  \strut

  \begin{enumerate}

  \item Change the program so that the parts can include aluminum.
    There are various ways of doing this, from simply copying and
    changing the brass or steel code to defining a materials cost
    object and creating three instances of that.

  \item Change the program so that it includes an inventory (how much
    is in stock) of each part.

  \item Print out all costs in dollars and cents, in the form
    \verb^$ddd.cc^. Test with \$1.00, \$1.2345 (to print as \$1.23),
    \$10.00, \$12.3456, and \$0.0345.  {\em Hint:} Use the I/O
    manipulator \verb^setiosflags(ios::fixed)^ to set non-scientific
    notation.  This one is used the same way as other I/O manipulators
    that are discussed in the book. It is turned off by
    \verb^resetiosflags(ios::fixed)^.

  \item Modify the part class so that it includes the manufacturing
    cost.

  \item Expand your menu to allow the user to change the cost of the
    materials.

  \item Expand your menu to allow the user to correct mistakes in
    entering part data.

  \item Expand your menu to allow the user to delete incorrectly
    entered part data.

  \item Expand your menu to allow the user to print out the parts
    defined so far.

  \item Create an error message function \verb^error_msg^ so that, for
    example, \verb^error_msg("Any text",^ \verb^5)^ will print out the
    message between the quotes, ring the bell, wait 5 seconds, and go
    to the next line.  Use this function to handle all your error
    messages.  Make the value 3 the default if the second argument is
    omitted.  {\em Hints:} Use \verb^sleep(i)^ to wait \verb^i^
    seconds. On Unix, you can find this function in \verb^unistd.h^,
    under DOS it should be in \verb^dos.h^.  Otherwise use:
\begin{verbatim}
   #include <time.h>
   void sleep(int i)
      {time_t start; start=time(NULL); while (time(NULL)-start<i);}
\end{verbatim}

  \item Add a menu option `U' that allows the user to either use kg or
    lb as unit of weight. In the menu header, print out whether we are
    using lb or kg, When the user chooses option U, the program will
    switch from kg units to lb units, or back.  But internally, store
    all values in kg units.

  \item Change the program so that it asks the user ``Do you really
    want to quit? [Y/N]: '' and allows the user to enter a `Y' or an
    `N' to quit or continue. It should keep prompting until the user
    enters Y or N.  Make sure the program is case-insensitive. {\em
    Hints:} Ask yourself: what sort of construct can keep asking for
    Y or N until the user enters one of the two? How can
    you abort the quitting process?

  \item Change your program so that it only uses storage for parts
    that are actually used.  So instead of creating, say, 100 parts
    using \verb^part_object^ \verb^part_array[100]^, only create a
    part when the user requests it by means of the ``P'' menu choice.
    {\em Hints:} You can do this by instead creating 100 {\em
      pointers} to parts using, say \verb^part_object^
    \verb^*part_pointer_array[100]^. (The star ensures that you create
    pointers to parts instead of actual parts, see the lesson
    ``Understanding Pointers''.)  Then when the user is defining a new
    part with the ``P'' menu choice, you can create the actual storage
    for that part with the \verb^part_pointer_array[...]^ \verb^=^
    \verb^new^ \verb^part_object;^ statement.  Note that you will have
    to use the arrow notation instead of the dot notation, for
    example, you must use \verb^part_pointer_array[...]->display(...)^
    instead of \verb^part_pointer_array[...].display(...)^.

  \item Whenever the user is to enter the cost of a material, show him
    the current value, and allow him to simply hit return if he wants
    to leave that value unchanged. {\em Hints:} Input all data
    using \verb^cin.getline^, including the menu choice.

  \end{enumerate}

\item[Evaluation]  \strut

  \begin{enumerate}
  \item Give two strengths of your group.
  \item Indicate two areas for improvement.
  \item What two new insights did your group obtain?
  \item Give two strengths of the class.
  \item Indicate two areas for improvement of the class.
  \item What two new insights did you obtain about the class?
  \end{enumerate}

\end{description}
\end{document}
