%%% SECTION %%%
\section{Unit Three Activities}
\begin{quote}
  Activities on Lesson page 4-2 (\code{double} and \code{float}) \\
  Activities on Lesson page 4-5 (Type \code{char}) \\
  Activities on Lesson page 4-6 (\code{boolean} and its weird-looking 
  operators) \\
  Activities on Lesson page 6-2 (Class \code{Math} and a review of 
  triginometric functions) \\
\end{quote}

%% SECTION %%
\section{Overview}

When you are finished this unit, you will be able to use decimal
values in a program, understand the boolean (the ``true-or-false'')
logic of type \code{boolean}, and know how to use the built-in
mathematical abilities of class \code{Math}.

%%% SECTION %%%
\section{Lesson Page 4-2: Integral types and casting basics}
%% Paragraph on what this page teaches.
 % 

Integral constants (a.k.a. literals), operations on variables of type 
\code{int} and \code{long}, and how to convert from one type to 
another.

\begin{description}
\item\textbf{Activity 4-2-1: Integral constants (literals)}

  \phrase{Given the line of code:
    $$\textrm{\code{int buttons= 33 + 2 * 22;}}$$

  Circle the integral constants (the literals).}
%% 33, 2, 22 are integer constants.
  

  
\item\textbf{Activity 4-2-2: Expressions of type \code{int}}


  \phrase{The following mathematical statement is true if you follow
  the conventions Java uses when doing the calculation.  Why?
  $$\textrm{3 + (4 + 2 * (7 / 2)) / 4 = 5}$$}
  %% Because integer division in Java rounds towards zero.
   % 7 / 2 = 3 and 10 / 4 = 2

  \phrase{What is the value of \code{x}?
  $$\textrm{\code{int x= 3 - - 1;}}$$}
  %% The value is 4; the space between the dashes is required.
  

  \truefalse{The largest \code{int} value is 2,147,483,647, so if you
  tried to add 2,000,000,000 with 200,000,000 and store it in an
  \code{int} variable, your program might produce incorrect results.}
  %% True.
  
  
  \phrase[0in]{If you try to store the value 3,000,000,000 in an 
  \code{int} variable, you will cause an \blankfill{1in} because the 
  value is too large to store in an \code{int}.}
  %% overflow
  
  
\item\textbf{Activity 4-2-3: Promoting values to a wider type}

  \phrase{What does it mean to say one type is wider than another?}
  %% That one type can hold more information because it takes up 
   % more space in memory than the other.

  \truefalse{Type \code{int} is wider than type \code{long}.}
  %% False.
  
  \truefalse{The types most commonly used to contain numbers are
  \code{int} and \code{long} because types \code{byte} and
  \code{short} have a limited range.}
  %% True.
  
  \truefalse{Types \code{int} and \code{short} take up less space 
  than types \code{byte} and \code{long}.}
  %% False. Types \code{byte} and \code{short} take up less space 
   % than types \code{int} and \code{long}.}
  
  \truefalse{You can store the value 99.3 in a variable of type 
  \code{long}.}
  %% False. Neither an \code{long}, \code{int}, \code{short} nor 
   % \code{byte} can store decimal places.
  
  \phrase{If you wanted to keep track of the number of people 
  at a party, you would use a variable of type \blankfill{1in}.}
  %% int
  
  \phrase{If you wanted to count the number of trees in one acre of 
  forest, you would use a variable of type \blankfill{1in}.}
  %% int
  
  
\item\textbf{Activity 4-2-4: Casting integral values}

  \truefalse{You would use casting when you want to store a \code{byte} 
  value in an \code{int}.}
  %% True.

  \truefalse{You can always store an \code{int} in a \code{byte}.}
  %% False. If the value is outside the range a \code{byte} can hold,
   % there will be overflow.
  
  \truefalse{You can always store a \code{int} value in a \code{long} 
  variable.}
  %% True.

  \phrase{How do you find the largest value an \code{int} can hold?}
  
  \phrase{Fill in the blanks to cast appropriately (if needed): \\
  
  \code{byte b= \blankfill{1in} 3


%% Definitions and phrase completions
 % 




%% EXAMPLES OF QUESTION OUTLINES:
 % 

  \phrase{Write the form of a \textit{variable declaration}:}
  
  \phrase[0in]{Write the steps to executing an assignment statement:
    \begin{enumerate}
    \item {}
    \item {}
    \end{enumerate}}
    
  \phrase[0in]{Given \code{x= 5; y= 2; z= 3;} what is the value of \code{z}
  after execution of each line of code? (Assume \code{z= 3;} at the
  start of each line.)
  \begin{enumerate}
      \item {\code{z= 4;}}
      \item {\code{z= y;}}
      \item {\code{z= 22 / x;}}
      \item {\code{z= x + z;}}
      \item {\code{z= x + (z * y);}}
      \item {\code{z= y + z * x;}}
      \item {\code{z= (3 * (- (z)));}}
      \end{enumerate}
    Write a program that prints the value of each of these to verify 
    your answers.
  }
  
  \begin{exercise}
    The statement $$\code{int numberOfFeet= 2;}$$ stores the value
    \code{2} in variable \code{numberOfFeet}, and the code
    $$\code{System.out.println(numberOfFeet);}$$ prints the value stored in
    \code{numberOfFeet}.
    
    You should all recognize the pythagorean formula $a^2 + b^2 =
    c^2$ for calculating the length of a hypotenuse of a right
    triangle.  Write a program that declares an \code{int} variable
    called \code{cSquared}. Variable \code{cSquared} should store the
    square of the length of the hypotenuse of a triangle with side
    $a$ of length 3 and side $b$ of length 5. The last statement of
    the program should print the value of \code{cSquared}.
  \end{exercise}
  
  \truefalse{A variable may only be assigned a value once during
    execution of a program.}


\item\textbf{Activity x-x-x: ActivityTitle}

%% Definitions and phrase completions
 % 


\item\textbf{Activity x-x-x: ActivityTitle}

%% Definitions and phrase completions
 % 


\item\textbf{Activity x-x-x: ActivityTitle}

%% Definitions and phrase completions
 % 
\end{description}


\section{\code{double} and \code{float}}
\section{Type \code{char}}
\section{\code{boolean} and some weird-looking operators}
\section{Class \code{Math}}
\section{Review of triginometric functions}
