\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 Basic Programming}\\
  \strut \\
  {Group:\ \hrulefill
   \ \ \ \ Captain:\ \hrulefill\hrulefill\hrulefill
   \ \ \ \ Recorder:\ \hrulefill\hrulefill\hrulefill
   \ \ \ \ Reflector:\ \hrulefill\hrulefill\hrulefill}
\end{center}

\begin{description}

\item[Motivation] \strut\hfill \\

In order to write a program that can ``remember'' properties
of parts, cost of materials, etcetera, you need variables.
Varables can be thought of as named storage locations.

In order to get the values of material cost, material content of
parts, etcetera, into the storage locations, you need to know about
input and output (IO).

\item[Objectives] \strut

  \begin{enumerate}
  \item Learn about variables.
  \item Learn about assignments.
  \item Learn about input and output.
  \item Learn about numerical expressions.
  \item Learn about program neatness.
  \item Strengthen previous knowledge.
  \end{enumerate}

\item[Performance Criteria]  \strut

  \begin{enumerate}
  \item Success in writing a program that reads the cost of steel per
    unit weight as well as the steel weight of a part from the
    keyboard, computes the cost of the steel in that part, and outputs
    that cost.  Storage locations to create: \verb^steel_cost^,
    (containing the cost of steel per kg or lb),
    \verb^part_steel_content^, (containing the amount of steel in the
    part being computed), and \verb^part_material_cost^, (containing
    the total cost of material, just steel for now, for the part being
    computed.) (25\%)
  \item Success in modifying the program for a part that also has, or
    may have, some brass content. Variable
    \verb^part_material_cost^ now should contain the total cost of
    material, both steel and brass, for the part being computed.
    You also will need to define additional variable names. (25\%)
  \item Program neatness, including lots of clear and meaningful
    comments, clear and meaningful variable names, indentation,
    strategic blank lines, etcetera. {\em Do not use the tab key to
      tab, but the space bar.}  (20\%)
  \item The knowledge demonstrated by your definitions of the vocabulary.
    (10\%)
  \item The depth of understanding demonstrated by your answers to the
    critical thinking questions.
    (20\%)
  \end{enumerate}

\item[Resources]  \strut

  \begin{enumerate}
  \item Your class notes.
  \item The textbook.
  \item The online help facilities of Windows and the C++ compiler.
  \end{enumerate}

\item[Plan]  \strut

  \begin{enumerate}
  \item Skim through the lessons ``Writing Messages to Your Screen'',
    ``Programs Store Information in Variables'', ``Performing Simple
    Operations'', and ``Reading Keyboard Input'' of the book.
  \item Create your program, compile and execute it.
  \item Create the second modified program.
  \item E-mail the program to the instructor and group members.
  \item See what vocabulary you can define.
  \item See what critical thinking questions you can answer.
  \item Take the test and submit it.
  \end{enumerate}

\item[Vocabulary]  \strut

  Select the best answer:

  \begin{enumerate}
  \item I/O.
    \begin{enumerate}
    \item Getting data in and out of the computer
    \item Independent Operations
    \item Interactive Operations
    \end{enumerate}
  \item Variables.
    \begin{enumerate}
    \item Named storage locations
    \item Names for storage locations
    \item Storage locations that can contain anything
    \end{enumerate}
  \item Variable types.
    \begin{enumerate}
    \item Named storage locations
    \item Names for storage locations
    \item Allowable possible contents for storage locations
    \end{enumerate}
  \item Precedence.
    \begin{enumerate}
    \item Order in which statements occur
    \item Order in which computations occur
    \item Order in which compilation occurs
    \end{enumerate}
  \end{enumerate}

\item[Critical Thinking Questions]  \strut

  Select the best answer:

  \begin{enumerate}

  \item What output do you get from the statement:
\begin{verbatim}
    cout << "H" << "el" << 'l' << 'o' << endl;
\end{verbatim}
    \begin{enumerate}
    \item \verb^Hello^
    \item \verb^H el l o^
    \item \verb^"H" << "el" << 'l' << 'o' << endl^
    \end{enumerate}

  \item What output do you get from the statement:
\begin{verbatim}
    cout << "0.500 = " << 0.500 << endl;
\end{verbatim}
    \begin{enumerate}
    \item \verb^0.500 = 0.500^
    \item \verb^0.5 = 0.5^
    \item \verb^0.500 = 0.5^
    \end{enumerate}

  \item What is the difference in output between the program segments
    on the left and on the right:
\begin{verbatim}
    cout << "Line 1\nLine 2\n";       cout << "Line 1\n";
                                      cout << "Line 2\n";
\end{verbatim}
    \begin{enumerate}
    \item Everything is printed on the same line by the left segment,
      on two separate lines for the right.
    \item The left segment single-spaces two lines, the right segment
      double-spaces them.
    \item There is no difference.
    \end{enumerate}

  \item What is the difference in output between the program pieces on
    the left and on the right:
\begin{verbatim}
    cout << "Line 1\n";      cout << "Line 1" << endl
    cout << "Line 2\n";           << "Line 2" << endl;
\end{verbatim}
    \begin{enumerate}
    \item The Left segment single-spaces two lines, the right segment
      double-spaces them.
    \item There is no difference.
    \item The segment on the right will not compile: the \verb^cout^
      is missing.
    \end{enumerate}

  \item What should you get from the statement:
\begin{verbatim}
    cout << "\a" << "Hi" << "there" << endl;
\end{verbatim}
    (Does not work on the PCs, but works on Unix.)
    \begin{enumerate}
    \item The program writes on the screen \verb^\a Hi there^
    \item The program writes on the screen \verb^\aHithere^
    \item The program writes on the screen \verb^Hithere^
      and the computer beeps.
    \end{enumerate}

  \item Why is the program on the right much better than the one on
    the left:
\begin{verbatim}
    #include <iostream.h>            #include <iostream.h>
    void main(void) {                void main(void) {
       int a;                           int a;
       ...                              int b;
       int b;                           ...
       ...                              ...
       a=1;                             a=1;
       b=3;                             b=3;
       cout << a+b << endl;             cout << a+b << endl;
       ...                              ...
    }                                }
\end{verbatim}
    (The dots stand for lots of other statements that are not important.)
    \begin{enumerate}
    \item All declarations of variables must be at the start.
    \item It is easier for someone to find out about a variable such
      as \verb^b^ if all declarations are grouped together.
    \end{enumerate}

  \item What is obviously wrong (except lack of neatness):
\begin{verbatim}
    #include <iostream.h>
    void main(void) {
    int pi;
    ...
    pi = 3.141593;
    ...
    }
\end{verbatim}
    \begin{enumerate}
    \item There should be a semi-colon at the end of the
      \verb^include^ line.
    \item The assignment statement \verb^pi = 3.141593;^ will crash.
    \item Variable \verb^pi^ is set to 3, not to 3.141593
    \end{enumerate}

  \item Why is the program on the left much better than the one on the
    right:
\begin{verbatim}
    #include <iostream.h>           #include <iostream.h>
    void main(void) {               void main(void) {
       float pi = 3.141593;            float pi;
       ....                            ....
       ....                            pi=3.141593
       ....                            ....
       area = pi*r*r                   area = pi*r*r
       ....                            ....
\end{verbatim}
    \begin{enumerate}
    \item It is easier to check whether variable \verb^pi^ has been
      given the right value.
    \item Computers cannot store many lines of code.  You worry about
      every line.
    \item If we give \verb^pi^ a value early, it will be sure to have
      received the value by the time we reach the \verb^area=^
      statement.
    \end{enumerate}

  \item Why is the comment on the left much better than the one on the
    right:
\begin{verbatim}
    #include <iostream.h>           #include <iostream.h>

    void main(void) {               void main(void) {
       // Declarations:                // Declarations:

       // Define pi:                   float pi = 3.141593; // pi is defined
       float pi = 3.141593;            ....
       ....                            ....
\end{verbatim}
    \begin{enumerate}
    \item You cannot put comments behind statements, they must be on
      separate lines.
    \item By the time the reader reads the comment in the program on
      the right, he/she is either mystified or already has figured the
      statement out by himself.
    \end{enumerate}

  \item Which people can benefit from the comments that you put in
    your program?
    \begin{enumerate}
    \item You right now.
    \item You, when you try to reuse the program a year from now.
    \item Someone who wants to use your program but does not know
      exactly what it does.
    \item Someone who wants to modify your program for a similar task.
    \item All of the above.
    \end{enumerate}

  \item Can you store arbitrarily large integers in an int? In a long int?
    \begin{enumerate}
    \item Yes. Yes.
    \item No, there are limitations on the size. Yes.
    \item No. No, but you can store larger integers.
    \end{enumerate}

  \item Can you store arbitrarily large real numbers in a float?
    In a double?
    \begin{enumerate}
    \item Yes. Yes.
    \item No, there are limitations on the size. Yes.
    \item No. No, but maybe you can store larger real numbers.
    \end{enumerate}

  \item Can you store arbitrarily accurate floating point numbers such
    as $\pi$ or $\sqrt 2$ in a float?  In a double?
    \begin{enumerate}
    \item Yes. Yes.
    \item No, there are limitations on the number of digits behind the
      first nonzero one that are going to be stored. Yes.
    \item No. No, but you can store more digits.
    \end{enumerate}

  \item What do you get from:
\begin{verbatim}
    cout << "3*3 = " << 3*3 << endl;
\end{verbatim}
    \begin{enumerate}
    \item \verb^3*3 = 3*3^
    \item \verb^9 = 9^
    \item \verb^3*3 = 9^
    \end{enumerate}

  \item What do you get from:
\begin{verbatim}
    float a; ...; a=1.5; cout << a << endl;
\end{verbatim}
    \begin{enumerate}
    \item 0
    \item 1
    \item 1.5
    \end{enumerate}

  \item What do you get from:
\begin{verbatim}
    int a; ...; a=1.5; cout << a << endl;
\end{verbatim}
    \begin{enumerate}
    \item 0
    \item 1
    \item 1.5
    \end{enumerate}

  \item What do you get from:
\begin{verbatim}
    cout << ".33 = " << 1/3 << endl;
\end{verbatim}
    \begin{enumerate}
    \item \verb^.33 = 0^
    \item \verb^.33 = .33^
    \item \verb^.33 = .3333333^
    \end{enumerate}

  \item What do you get from:
\begin{verbatim}
    cout << ".33 = " << 1./3 << endl;
\end{verbatim}
    \begin{enumerate}
    \item \verb^.33 = 0^
    \item \verb^.33 = .33^
    \item \verb^.33 = .3333333^
    \end{enumerate}

  \item What do you get from:
\begin{verbatim}
    cout << "Large: " << 300000*300000 << endl;
\end{verbatim}
    \begin{enumerate}
    \item \verb^Large: 300000*300000^
    \item \verb^Large: 90000000000^
    \item Neither
    \end{enumerate}

  \item What do you get from:
\begin{verbatim}
    cout << "9 = " << 1+2*3 << endl;
\end{verbatim}
    \begin{enumerate}
    \item \verb^9 = 1+2*3^
    \item \verb^9 = 9^
    \item \verb^9 = 7^
    \end{enumerate}

  \item What do you get from:
\begin{verbatim}
    cout << ".25 = " << 1./2.*2. << endl;
\end{verbatim}
    \begin{enumerate}
    \item \verb^.25 = 1./2.*2.^
    \item \verb^.25 = .25^
    \item \verb^.25 = 1.^
    \end{enumerate}

  \item What do you get from:
\begin{verbatim}
    cout << "1 = " << 1./2./2. << endl;
\end{verbatim}
    \begin{enumerate}
    \item \verb^1 = 0^
    \item \verb^1 = .25^
    \item \verb^1 = 1.^
    \end{enumerate}

  \item What do you get from:
\begin{verbatim}
    int i; ...; i=1; cout << i++; cout << i << endl;
\end{verbatim}
    \begin{enumerate}
    \item \verb^11^
    \item \verb^1 1^
    \item \verb^12^
    \end{enumerate}

  \item What do you get from:
\begin{verbatim}
    int i; ...; i=1; cout << ++i; cout << i << endl;
\end{verbatim}
    \begin{enumerate}
    \item \verb^11^
    \item \verb^2 1^
    \item \verb^22^
    \end{enumerate}

  \item What happens during the execution of:
\begin{verbatim}
    int i,j; ...; cin >> i >> j;
\end{verbatim}
    \begin{enumerate}
    \item The program prints out \verb^ij^.
    \item The program prints out the values of variables \verb^i^ and
      \verb^j^
    \item The program waits for you to type in \verb^ij^.
    \item The program waits for you to type in \verb^i j^.
    \item The program pauses at the \verb^cin^ statement until you
      enter two integer values from the keyboard.  It stores these in
      variables \verb^i^ and \verb^j^.
    \end{enumerate}

  \end{enumerate}

\item[Exercises]  \strut

  \begin{enumerate}
  \item How do you create a simple table?
  \item Print out a zero (O) if a number is odd and a 3 (an inverted
    E) if the number is even, using only what you have learned so far.
  \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 so far.
  \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}
