10 part are due on 16 November at 11pm, and the third part on 23 November |
10 part are due on 16 November at 11pm, and the third part on 23 November |
11 at 11pm. You are asked to implement three programs about list |
11 at 11pm. You are asked to implement three programs about list |
12 processing and recursion. The third part is more advanced and might |
12 processing and recursion. The third part is more advanced and might |
13 include material you have not yet seen in the first lecture. |
13 include material you have not yet seen in the first lecture. |
14 Make sure the files you submit can be processed by just calling |
14 Make sure the files you submit can be processed by just calling |
15 \texttt{scala <<filename.scala>>}. |
15 \texttt{scala <<filename.scala>>}.\bigskip |
|
16 |
|
17 \noindent |
|
18 \textbf{Important:} Do not use any mutable data structures in your |
|
19 submissions! They are not needed. This excludes the use of |
|
20 \texttt{ListBuffer}s, for example. Do not use \texttt{return} in your |
|
21 code! It has a different meaning in Scala, than in Java. |
|
22 Do not use \texttt{var}! This declares a mutable variable. Make sure the |
|
23 functions you submit are defined on the ``top-level'' of Scala, not |
|
24 inside a class or object. |
16 |
25 |
17 |
26 |
18 \subsection*{Disclaimer} |
27 \subsection*{Disclaimer} |
19 |
28 |
20 It should be understood that the work you submit represents |
29 It should be understood that the work you submit represents |
193 because Mr Drumb refuses to make his tax records public). |
202 because Mr Drumb refuses to make his tax records public). |
194 |
203 |
195 Since the question about Mr Drumb's business acumen remains, let's do a |
204 Since the question about Mr Drumb's business acumen remains, let's do a |
196 quick back-of-the-envelope calculation in Scala whether his claim has |
205 quick back-of-the-envelope calculation in Scala whether his claim has |
197 any merit. Let's suppose we are given \$100 in 1978 and we follow a |
206 any merit. Let's suppose we are given \$100 in 1978 and we follow a |
198 really dump investment strategy, namely: |
207 really dumb investment strategy, namely: |
199 |
208 |
200 \begin{itemize} |
209 \begin{itemize} |
201 \item We blindly choose a portfolio of stocks, say some Blue-Chip stocks |
210 \item We blindly choose a portfolio of stocks, say some Blue-Chip stocks |
202 or some Real Estate stocks. |
211 or some Real Estate stocks. |
203 \item If some of the stocks in our portfolio are traded in January of |
212 \item If some of the stocks in our portfolio are traded in January of |