cws/cw01.tex
changeset 20 07860dd35c2b
parent 18 87e55eb309ed
child 24 66b97f9a40f8
equal deleted inserted replaced
19:fa18976cf4cf 20:07860dd35c2b
    77   assume this function will be called with numbers between $1$ and
    77   assume this function will be called with numbers between $1$ and
    78   $1$ million. \hfill[2 Marks]
    78   $1$ million. \hfill[2 Marks]
    79 
    79 
    80 \item[(2)] Write a second function that takes an upper bound as
    80 \item[(2)] Write a second function that takes an upper bound as
    81   argument and calculates the steps for all numbers in the range from
    81   argument and calculates the steps for all numbers in the range from
    82   1 upto this bound. It returns the maximum number of steps and the
    82   1 up to this bound. It returns the maximum number of steps and the
    83   corresponding number that needs that many steps.  The first
    83   corresponding number that needs that many steps.  The first
    84   component of the pair is the number of steps and the second is the
    84   component of the pair is the number of steps and the second is the
    85   corresponding number. \hfill[1 Mark]
    85   corresponding number. \hfill[1 Mark]
    86 \end{itemize}
    86 \end{itemize}
    87 
    87 
   131 \url{http://ichart.yahoo.com/table.csv?s=GOOG}
   131 \url{http://ichart.yahoo.com/table.csv?s=GOOG}
   132 \end{center}
   132 \end{center}
   133 
   133 
   134 \noindent where \texttt{GOOG} stands for Google's stock market symbol
   134 \noindent where \texttt{GOOG} stands for Google's stock market symbol
   135 then you will receive a CSV-list of the daily stock prices since
   135 then you will receive a CSV-list of the daily stock prices since
   136 Google was listed. You can also try this with other strock market
   136 Google was listed. You can also try this with other stock market
   137 symbols, for instance AAPL, MSFT, IBM, FB, YHOO, AMZN, BIDU and so
   137 symbols, for instance AAPL, MSFT, IBM, FB, YHOO, AMZN, BIDU and so
   138 on. 
   138 on. 
   139 
   139 
   140 This function should return a List of strings, where each string
   140 This function should return a List of strings, where each string
   141 is one line in this CVS-list (representing one day's
   141 is one line in this CVS-list (representing one day's
   182 
   182 
   183 \subsection*{Advanced Part 3 (3 Marks)}
   183 \subsection*{Advanced Part 3 (3 Marks)}
   184 
   184 
   185 A purely fictional character named Mr T.~Drump inherited in 1978
   185 A purely fictional character named Mr T.~Drump inherited in 1978
   186 approximately 200 Million Dollar from his father. Mr Drump prides
   186 approximately 200 Million Dollar from his father. Mr Drump prides
   187 himself to be a brilliant bussiness man because nowadays it is
   187 himself to be a brilliant business man because nowadays it is
   188 estimated he is 3 Billon Dollar worth (one is not sure, of course,
   188 estimated he is 3 Billion Dollar worth (one is not sure, of course,
   189 because Mr Drump refuses to make his tax records public).
   189 because Mr Drump refuses to make his tax records public).
   190 
   190 
   191 The question about Mr Drump's bussiness acumen remains. So let's do a
   191 The question about Mr Drump's business acumen remains. So let's do a
   192 quick back-of-the-envelope calculation in Scala whether his claim has
   192 quick back-of-the-envelope calculation in Scala whether his claim has
   193 any merit. Let's suppose we are given \$100 in 1978 and we follow a
   193 any merit. Let's suppose we are given \$100 in 1978 and we follow a
   194 really dump investment strategy, namely:
   194 really dump investment strategy, namely:
   195 
   195 
   196 \begin{itemize}
   196 \begin{itemize}