%%% UNCOMMENT THIS TO PRINT AN ANSWER KEY (and comment out the other \documentclass)
%\documentclass[11pt,addpoints,answers]{exam}
%\newcommand{\SOLUTION}{ \textcolor{red}{-- SAMPLE SOLUTION --} } % TODO: uncomment this line to show SOLUTION LABEL
%\newcommand{\CORRECT}{ \textcolor{red}{CORRECT}} 

%%% UNCOMMENT THIS TO PRINT AN EXAM (and comment out the other \documentclass)
\documentclass[11pt,addpoints]{exam}
\newcommand{\SOLUTION }{Lecture Handout } % TODO: uncomment this line to so no solution label is included
\newcommand{\CORRECT}{} 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
%    TODO: Change HANDOUT VARIABLES for EACH HANDOUT
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\handoutname}{Variable Terminology}      % 1-primary          2-secondary          3-tertiary
\newcommand{\handoutcolor}{Yellow}   %  Yellow-primary  Green-secondary   Buff-tertiary
\newcommand{\weeknumber}{11}   % 1-primary          2-secondary          3-tertiary
\newcommand{\week}{Week \weeknumber }               %  P-primary         S-secondary          T-tertiary

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
%    TODO: Change HANDOUT VARIABLES for EACH SEMESTER and COURSE OFFERING
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\semester}{Spring }
\newcommand{\yr}{2015 }   % \year was already defined elsewhere, but could not use
\newcommand{\lecA}{Lec 001\: Deppeler 800TR}
\newcommand{\lecB}{Lec 002\: Deppeler 100TR}
\newcommand{\instructorfull}{Deb Deppeler}
\newcommand{\instructor}{Deppeler} % fits better in header and footer
\newcommand{\coursenumber}{302}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setlength{\parindent}{0pt}
\usepackage[utf8]{inputenc}
\usepackage{changepage}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{latexsym}
\usepackage{textcomp}
\usepackage{dashrule}
\usepackage{multirow}
\usepackage{array}
\usepackage{enumitem}
\usepackage{color}

\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%       CODE ENVIRONMENT FOR LONGER CODE FRAGMENTS
%       TO USE: \begin{lstlisting} [code] \end{lstlisting}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{listings}     % for preformatted code fragments
\usepackage{lmodern}   % NEEDED FOR BOLD FONTS WITHIN LISTINGS  
\lstset{
  language=Java,
  emph={EXPR,EXPR1,EXPR2,COND,COND1,COND2,STMT,STMT1,STMT2,DEC_STMT,CODE,CODE1,CODE2},  % LABELS that are bold and underline
  emphstyle=\bfseries\underbar,
  frame=none,   % default to none, can set =single, =tb, 
  aboveskip=3mm,
  belowskip=3mm,
  showstringspaces=false,
  columns=flexible,
  basicstyle={\small\ttfamily},
  numbers=none,
  numberstyle=\tiny\color{gray},
  keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  stringstyle=\color{mauve},
  breaklines=true,
  breakatwhitespace=true,
  tabsize=4
}

%%  TIP: to get list enumerated with lowercase roman numerals: i,ii,iii,iv,iv, ...
%\begin{enumerate}[label={\roman*}]
%\item double d = s;
%\item double d = c;
%\item double d = t;
%\end{enumerate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% package:exams POINTS STYLE AND PLACEMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pointpoints{pt}{pts}
\pointsinrightmargin

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% HEADER & FOOTER STYLE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{headandfoot}
\runningheadrule
%\firstpageheader{}{}{}
\firstpageheader{CS\coursenumber \space \handoutname \space }{\week: \SOLUTION}{\textcopyright \yr \instructor}
\runningheader{CS\coursenumber \space \handoutname \space }{\week: \SOLUTION}{\textcopyright \yr \instructor}
\firstpagefooter{\textcopyright  \yr  \instructor}{CS\coursenumber \space \handoutname \week \SOLUTION}{Page \thepage\ of \numpages}
\runningfooter{}{CS\coursenumber \space \handoutname \space \SOLUTION}{Page \thepage\ of \numpages}
\runningfootrule

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% \includegraphics[width=6in]{computer_components.png}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\section*{Variable, Method, and Constructors}

variables and methods are not the same \\ 

variables can be declared with (as) primitive types \\
(int double char boolean short long float byte) \\

variables can be declared with (as) reference types \\
(everything else--String Character Integer Scanner Random Apple Snake PortalPair ...) \\

variables can be instance variables (non-static fields) \\
variables can be class variables (static fields) \\
variables can be parameters (declared in the parameter list of a method or constructor) \\
variables can be local (declared within a method) \\
variables can be temporary (declared within a construct like an if statement or loop code) \\
variables can be CONSTANT (final fields) \\

methods can be instance methods (non-static) \\
methods can be class methods (static) \\
methods can be final (final methods can not be inherited) \\
methods can be void (have void as their return type) \\
methods can be non-void (have some other return type and return a value of that type) \\
methods have parameters lists (variables do not) \\

constructors can have parameter lists \\
constructors do not have return types  \\
constructors can not be declared as static or final (because they are implicitly static and final) \\


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SECTION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\section*{How to Connect to a Remote Computer (UW-Madison CS Dept)}

%%  TIP: to get list enumerated with lowercase roman numerals: i,ii,iii,iv,iv, ...
%\begin{enumerate}[label={\roman*}]
%\item \texttt{ double d = s.hasNextDouble(); }
%\item\texttt{  double d = c; }
%\item\texttt{  double d = t; }
%\end{enumerate}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PAGE n: 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{questions}

%\question What's next?

%\end{questions}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% QUESTION  -Y   -G                                                QUESTION TEMPLATE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\question ?
%
%\begin{lstlisting}[frame=single]      % = none, =tb, =lr
%
%code fragment here
%
%\end{lstlisting}
%
%\begin{enumerate}[label={\roman*}]
%\item one
%\item two
%\item three
%\end{enumerate}
%	
%\begin{choices}
%\choice {\tt !}
%\choice @
%\choice \#
%\choice \$
%\choice \%
%\end{choices}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% QUESTION  -Y   -G                                                HAVE YOU ANSWERED ALL QUESTIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\newpage
%
%\hdashrule{\textwidth}{0.5pt}{1pt}
%
%Check that you have answered all questions and bring your UW ID and turn in your exam question paper and scantron sheet.
%
%\hdashrule{\textwidth}{0.5pt}{1pt}


%\end{questions}

\end{document}

%%%%%%%%%%%%%%%%%%%%%% SAMPLE FORMAT EXAMPLES %%%%%%%%%%%%%
% ROMAN NUMERAL 
%\begin{enumerate}[label={\roman*}]
%\item \texttt{ double d = s.hasNextDouble(); }
%\item\texttt{  double d = c; }
%\item\texttt{  double d = t; }
%\end{enumerate}
%
%
%\question Which replacement for \textbf{\underline{CODE}} completes this method, which  must return true if and only if the value of \texttt{cents} is between 0 (inclusive) and 100 (inclusive).  Otherwise, the method must return false.
%
%\begin{lstlisting}[frame=none] 
%	public static boolean validCents (int cents) {
%  		CODE
%	}
%\end{lstlisting}
%
%\begin{choices}
%
%\choice \begin{lstlisting}[frame=none] 
%return true || false;
%\end{lstlisting}
% 
%\choice \begin{lstlisting}[frame=none] 
%if ( cents >= 0 ) { return true; }
%else if ( cents <= 100 ) { return true; }
%else { return false; }
%\end{lstlisting}
% 
%\choice \begin{lstlisting}[frame=none] 
%return !(cents < 0 || cents > 100);
%\end{lstlisting}
%
%\choice \begin{lstlisting}[frame=none] 
%if ( cents <= 100 || cents >= 0 ) { return true; }
%else { return false; }
%return 0 <= cents <= 100 ;
%\end{lstlisting}
%
%\end{choices}
%
%%%%%%%%%%%%%%%%%%%%%% SAMPLE FORMAT EXAMPLES %%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%% PYTHON EXAMPLES by HOBBES %%%%%%%%%%%%%
%
%  SAMPLE QUESTIONS FROM HOBBES CS301 -- kept for examples of fill-in the blank and multi-column
%
%%%%%%%%%%%%%%%%%%%%%% PYTHON EXAMPLES by HOBBES %%%%%%%%%%%%%
%\newpage
%
%\section{Question Type Examples}
%
%\subsection*{True or False: Basic Python information}
%

%%%%%%%%%%%%%%%%%%%%%%% QUESTION CHECKBOXES, TWO COLUMNS & TWO ROWS of choices
% QUESTION  -Y   -G
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\question[4] What is the \textit{value} in {\tt x} after the following line of code is executed?
%\begin{adjustwidth}{1.3cm}{}
%{\tt x = "string"[1] + "berry"[-1]}
%\end{adjustwidth}
%
%%%%%%%%%%%%%%%%%%%%%%% QUESTION FILL IN THE BLANK EXAMPLES of choices
% QUESTION  -Y   -G
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
%\vspace{4mm}
%
%\begin{multicols}{2}
%\begin{checkboxes}
%	\CorrectChoice {\tt one
%	five}
%	
%	\vspace{5mm}
%	
%	\choice {\tt one
%	two}
%	
%	\choice {\tt one
%	two
%	five}
%	
%	\vspace{5mm}
%	
%	\choice {\tt five}
%\end{checkboxes}
%\end{multicols}

%\subsection*{Fill-in-the-blank: Writing code}
%
%For each of the following questions, fill in the value, operator, or statement needed to produce the indicated output (check the comments if you need a hint). Pay attention to data types!
%
%\vspace{5mm}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% QUESTION  -Y   -G
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\question[6]
%\begin{adjustwidth}{.5cm}{}
%{\tt x = $\rule{5cm}{0.15mm}$ \# literal value
%
%print x * 5  \hspace{3.25cm}  \# output: 11111}
%\end{adjustwidth}
%
%\vspace{5mm}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% QUESTION  -Y   -G
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\question[6]
%\begin{adjustwidth}{.5cm}{}
%{\tt x = $\rule{6cm}{0.15mm}$ \hspace{3mm} \# code to get number 1-10 from user
%
%print x + 5 \hspace{4.75cm} \# output is a number between 6-15}
%\end{adjustwidth}
%
%\vspace{5mm}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% QUESTION  -Y   -G
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\question[6]
%\begin{adjustwidth}{.5cm}{}
%{\tt for x in range(10): \hspace{3.25cm} \# output: 1 2 3 4 5 6 7 8 9 10
%
%\vspace{3mm}
%
%\hspace{1cm} print $\rule{5cm}{0.15mm}$ \hspace{3mm} \# expression with x}
%\end{adjustwidth}
%
%\vspace{5mm}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% QUESTION  -Y   -G
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\question[6] Fill in the blanks in the condition so that it evaluates to {\tt True} for the {\tt int} values of {\tt x} indicated on the number line below. Empty circles are not included in the range.
%
%\begin{center}
%\includegraphics[clip=true, trim=4cm 12.25cm 2cm 5cm, scale=0.6]{NumberlineE1}
%\end{center}
%
%\vspace{2mm}
%\begin{adjustwidth}{.5cm}{}
%\hspace{1cm}{\tt ( x < 5 and $\rule{3cm}{0.15mm}$ ) or $\rule{4cm}{0.15mm}$}
%\end{adjustwidth}
%
%\vspace{5mm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% QUESTION  -Y   -G
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\question[6]
%\begin{adjustwidth}{.5cm}{}
%{\tt x = 3 \hspace{3.4cm} \# output: 27
%
%print x $\rule{2cm}{0.15mm}$ 3 \hspace{3mm} \# operator only}
%\end{adjustwidth}
%
%\vspace{5mm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% QUESTION  -Y   -G
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\question[6]
%\begin{adjustwidth}{.5cm}{}
%{\tt num\_spaces = 0
%
%for x in word: \hspace{3.4cm} \# assume word is some long string
%
%\hspace{1cm}if $\rule{5cm}{0.15mm}$: \# condition
%
%\hspace{2cm}num\_spaces += 1 \hspace{1.7cm} \# count number of spaces
%}
%\end{adjustwidth}

