cws/main_cw01.tex
changeset 399 b17a98b0c52f
parent 396 3ffe978a5664
child 411 f55742af79ef
equal deleted inserted replaced
398:7d9b765d4012 399:b17a98b0c52f
     6 
     6 
     7 
     7 
     8 
     8 
     9 \begin{document}
     9 \begin{document}
    10 
    10 
    11 \section*{Main Part 1 (Scala, 7 Marks)}
    11 \section*{Main Part 1 (Scala, 6 Marks)}
    12 
    12 
    13 \IMPORTANT{This part is about Scala. It is due on \cwSIXa{} at 5pm and worth 7\%.}
    13 \IMPORTANT{This part is about Scala. It is due on \cwSIXa{} at 5pm and worth 6\%.}
    14 
    14 
    15 \noindent
    15 \noindent
    16 Also note that the running time of each part will be restricted to a
    16 Also note that the running time of each part will be restricted to a
    17 maximum of 30 seconds on my laptop.
    17 maximum of 30 seconds on my laptop.
    18 
    18 
    62 \textbf{Note!} Fortunately Scala supports operator overloading. But
    62 \textbf{Note!} Fortunately Scala supports operator overloading. But
    63 make sure you understand the difference between \texttt{100 / 3} and
    63 make sure you understand the difference between \texttt{100 / 3} and
    64 \texttt{100.0 / 3}!
    64 \texttt{100.0 / 3}!
    65 
    65 
    66 \newpage
    66 \newpage
    67 \subsection*{Main Part 1 (7 Marks, file drumb.scala)}
    67 \subsection*{Main Part 1 (6 Marks, file drumb.scala)}
    68 
    68 
    69 A purely fictional character named Mr T.~Drumb inherited in 1978
    69 A purely fictional character named Mr T.~Drumb inherited in 1978
    70 approximately 200 Million Dollar from his father. Mr Drumb prides
    70 approximately 200 Million Dollar from his father. Mr Drumb prides
    71 himself to be a brilliant business man because nowadays it is
    71 himself to be a brilliant business man because nowadays it is
    72 estimated he is 3 Billion Dollar worth (one is not sure, of course,
    72 estimated he is 3 Billion Dollar worth (one is not sure, of course,
   117 \begin{itemize}
   117 \begin{itemize}
   118 \item[(1)] Write a function \texttt{get\_january\_data} that takes a
   118 \item[(1)] Write a function \texttt{get\_january\_data} that takes a
   119   stock symbol and a year as arguments. The function reads the
   119   stock symbol and a year as arguments. The function reads the
   120   corresponding CSV-file and returns the list of strings that start
   120   corresponding CSV-file and returns the list of strings that start
   121   with the given year (each line in the CSV-list is of the form
   121   with the given year (each line in the CSV-list is of the form
   122   \texttt{someyear-01-someday,someprice}).\hfill[1 Mark]
   122   \texttt{someyear-01-someday,someprice}).\hfill[0.5 Marks]
   123 
   123 
   124 \item[(2)] Write a function \texttt{get\_first\_price} that takes
   124 \item[(2)] Write a function \texttt{get\_first\_price} that takes
   125   again a stock symbol and a year as arguments. It should return the
   125   again a stock symbol and a year as arguments. It should return the
   126   first January price for the stock symbol in the given year. For this
   126   first January price for the stock symbol in the given year. For this
   127   it uses the list of strings generated by
   127   it uses the list of strings generated by
   210   
   210   
   211 \item[(7)] Write a function that calculates the overall balance
   211 \item[(7)] Write a function that calculates the overall balance
   212   for a range of years where each year the yearly profit is compounded to
   212   for a range of years where each year the yearly profit is compounded to
   213   the new balances and then re-invested into our portfolio.
   213   the new balances and then re-invested into our portfolio.
   214   For this use the function and results generated under (6).\\
   214   For this use the function and results generated under (6).\\
   215   \mbox{}\hfill\mbox{[1 Mark]}
   215   \mbox{}\hfill\mbox{[0.5 Marks]}
   216 \end{itemize}\medskip  
   216 \end{itemize}\medskip  
   217 
   217 
   218 
   218 
   219 
   219 
   220 \noindent
   220 \noindent