--- a/cws/cw01.tex Thu Dec 07 12:09:06 2017 +0000
+++ b/cws/cw01.tex Sat Dec 16 23:53:28 2017 +0000
@@ -1,5 +1,6 @@
\documentclass{article}
\usepackage{../style}
+\usepackage{disclaimer}
%%\usepackage{../langs}
\begin{document}
@@ -13,38 +14,13 @@
include material you have not yet seen in the first lecture.
\bigskip
-\noindent
-\textbf{Important:}
-
-\begin{itemize}
-\item Make sure the files you submit can be processed by just calling\\
-\mbox{\texttt{scala <<filename.scala>>}} on the commandline.
-
-\item Do not use any mutable data structures in your
-submissions! They are not needed. This means you cannot create new
-\texttt{Array}s or \texttt{ListBuffer}s, for example.
-
-\item Do not use \texttt{return} in your code! It has a different
- meaning in Scala, than in Java.
-
-\item Do not use \texttt{var}! This declares a mutable variable. Only
- use \texttt{val}!
-
-\item Do not use any parallel collections! No \texttt{.par} therefore!
- Our testing and marking infrastructure is not set up for it.
-\end{itemize}
+\IMPORTANT{}
\noindent
Also note that the running time of each part will be restricted to a
maximum of 360 seconds on my laptop.
-
-\subsection*{Disclaimer}
-
-It should be understood that the work you submit represents
-your \textbf{own} effort. You have not copied from anyone else. An
-exception is the Scala code I showed during the lectures or
-uploaded to KEATS, which you can freely use.\bigskip
+\DISCLAIMER{}
\subsection*{Part 1 (3 Marks)}
@@ -275,12 +251,13 @@
\noindent
Until Yahoo was bought by Altaba this summer, historical stock market
-data for such back-of-the-envelope calculations was available online
-for free, but nowadays this kind of data is difficult to obtain, unless
-you are prepared to pay extortionate prices or be severely
-rate-limited. Therefore this coursework comes with a number of files
-containing CSV-lists about historical stock prices for companies of
-our portfolio. Use these files for the following tasks.\bigskip
+data for such back-of-the-envelope calculations was freely available
+online. Unfortuantely nowadays this kind of data is difficult to
+obtain, unless you are prepared to pay extortionate prices or be
+severely rate-limited. Therefore this coursework comes with a number
+of files containing CSV-lists with the historical stock prices for the
+companies in our portfolios. Use these files for the following
+tasks.\bigskip
\noindent
\textbf{Tasks (file drumb.scala):}
@@ -304,7 +281,7 @@
stock price of this entry should be converted into a double. Such a
price might not exist, in case the company does not exist in the given
year. For example, if you query for Google in January of 1980, then
- clearly Google did not exists yet. Therefore you are asked to
+ clearly Google did not exist yet. Therefore you are asked to
return a trade price as \texttt{Option[Double]}\ldots\texttt{None}
will be the value for when no price exists.
@@ -378,15 +355,15 @@
balance of \$100 into roughly \$30,895 for real estate and a whopping
\$349,597 for blue chips. Note when comparing these results with your
own calculations: there might be some small rounding errors, which
-when compounded, lead to moderately different values.\bigskip
+when compounded lead to moderately different values.\bigskip
\noindent
\textbf{Hints:} useful string functions: \texttt{.startsWith(...)} for
-checking whether a string has a given prefix, \texttt{\_ + \_} for
+checking whether a string has a given prefix, \texttt{\_ ++ \_} for
concatenating two strings; useful option functions: \texttt{.flatten}
flattens a list of options such that it filters way all
\texttt{None}'s, \texttt{Try(...) getOrElse ...} runs some code that
-might raise an exception, if yes, then a default value can be given;
+might raise an exception---if yes, then a default value can be given;
useful list functions: \texttt{.head} for obtaining the first element
in a non-empty list, \texttt{.length} for the length of a
list.\bigskip