cws/cw01.tex
changeset 279 14bf4e478534
parent 276 52faee6d0be2
child 282 ec9773fe1dc0
equal deleted inserted replaced
278:0c2481cd8b1c 279:14bf4e478534
    10 
    10 
    11 \mbox{}\hfill\textit{``The most effective debugging tool is still careful thought,}\\
    11 \mbox{}\hfill\textit{``The most effective debugging tool is still careful thought,}\\
    12 \mbox{}\hfill\textit{coupled with judiciously placed print statements.''}\smallskip\\
    12 \mbox{}\hfill\textit{coupled with judiciously placed print statements.''}\smallskip\\
    13 \mbox{}\hfill\textit{ --- Brian W. Kernighan, in Unix for Beginners (1979)}\medskip\bigskip
    13 \mbox{}\hfill\textit{ --- Brian W. Kernighan, in Unix for Beginners (1979)}\medskip\bigskip
    14 
    14 
    15 
    15  
    16 \noindent
    16 \noindent
    17 This assignment is about Scala and worth 10\%. The basic
    17 This assignment is about Scala and worth 10\%. The preliminary
    18 part is due on \cwSIX{} at 11pm, and the main part on \cwSIXa{}
    18 part is due on \cwSIX{} at 16pm, and the core part on \cwSIXa{}
    19 at 11pm. You are asked to implement two programs about list
    19 at 16pm. You are asked to implement two programs about list
    20 processing and recursion. The main part is more advanced and might
    20 processing and recursion. The core part is more advanced and might
    21 include material you have not yet seen in the first lecture.
    21 include material you have not yet seen in the first lecture.
    22 \bigskip
    22 \bigskip
    23  
    23  
    24 \IMPORTANT{}
    24 \IMPORTANT{}
    25 
    25 
    84 \textbf{Note!} Fortunately Scala supports operator overloading. But
    84 \textbf{Note!} Fortunately Scala supports operator overloading. But
    85 make sure you understand the difference between \texttt{100 / 3} and
    85 make sure you understand the difference between \texttt{100 / 3} and
    86 \texttt{100.0 / 3}!
    86 \texttt{100.0 / 3}!
    87 
    87 
    88 \newpage
    88 \newpage
    89 \subsection*{Basic Part (3 Marks, file collatz.scala)}
    89 \subsection*{Preliminary Part (3 Marks, file collatz.scala)}
    90 
    90 
    91 This part is about recursion. You are asked to implement a Scala
    91 This part is about recursion. You are asked to implement a Scala
    92 program that tests examples of the \emph{$3n + 1$-conjecture}, also
    92 program that tests examples of the \emph{$3n + 1$-conjecture}, also
    93 called \emph{Collatz conjecture}. This conjecture can be described as
    93 called \emph{Collatz conjecture}. This conjecture can be described as
    94 follows: Start with any positive number $n$ greater than $0$:
    94 follows: Start with any positive number $n$ greater than $0$:
   167   
   167   
   168 
   168 
   169 
   169 
   170 
   170 
   171 
   171 
   172 \subsection*{Main Part (7 Marks, file drumb.scala)}
   172 \subsection*{Core Part (7 Marks, file drumb.scala)}
   173 
   173 
   174 A purely fictional character named Mr T.~Drumb inherited in 1978
   174 A purely fictional character named Mr T.~Drumb inherited in 1978
   175 approximately 200 Million Dollar from his father. Mr Drumb prides
   175 approximately 200 Million Dollar from his father. Mr Drumb prides
   176 himself to be a brilliant business man because nowadays it is
   176 himself to be a brilliant business man because nowadays it is
   177 estimated he is 3 Billion Dollar worth (one is not sure, of course,
   177 estimated he is 3 Billion Dollar worth (one is not sure, of course,