cws/main_cw01.tex
changeset 431 ef68136b9a96
parent 426 b51467741af2
child 463 0315d9983cd0
equal deleted inserted replaced
430:274c865b3878 431:ef68136b9a96
   204   $50 * -0.03573991804411003 + $50 * 0.539974575389325
   204   $50 * -0.03573991804411003 + $50 * 0.539974575389325
   205                                        = $25.21173286726075
   205                                        = $25.21173286726075
   206   \end{verbatim}
   206   \end{verbatim}
   207 
   207 
   208   as profit for that year, and our new balance for 2011 is \$125 when
   208   as profit for that year, and our new balance for 2011 is \$125 when
   209   converted to a \texttt{Long}.\mbox{}\hfill\mbox{[1 Mark]}
   209   converted to a \texttt{Long}. Since \texttt{yearly\_yield} should
       
   210   produce a \texttt{Long}, there are a number of ways how to round
       
   211   doubles.  One way to do the calculation is to calculate the profit
       
   212   first as \texttt{Double}, and then round the result down to a \texttt{Long}
       
   213   (using \texttt{.toLong}) and add it to the balance (which is also a
       
   214   \texttt{Long}).\\
       
   215   \mbox{}\hfill\mbox{[1 Mark]}
   210   
   216   
   211 \item[(7)] Write a function that calculates the overall balance
   217 \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
   218   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.
   219   the new balances and then re-invested into our portfolio.
   214   For this use the function and results generated under (6).\\
   220   For this use the function and results generated under (6).\\
   235 turn out to be a blue chip company.  Also, since the portfolios are
   241 turn out to be a blue chip company.  Also, since the portfolios are
   236 chosen from the current S\&P 500, they do not include the myriad
   242 chosen from the current S\&P 500, they do not include the myriad
   237 of companies that went bust or were de-listed over the years.
   243 of companies that went bust or were de-listed over the years.
   238 So where does this leave our fictional character Mr T.~Drumb? Well, given
   244 So where does this leave our fictional character Mr T.~Drumb? Well, given
   239 his inheritance, a really dumb investment strategy would have done
   245 his inheritance, a really dumb investment strategy would have done
   240 equally well, if not much better. And one would assume this guy is
   246 equally well, if not much better. Anyhow, one would assume that this
   241 by now locked up in prison and the key thrown away, but alas he
   247 guy is by now locked up in a prison and the key thrown away, but alas he
   242 is still around annoying commonsense people.\medskip
   248 is still around annoying commonsense people. What a pity.\medskip
   243 
   249 
   244 \end{document}
   250 \end{document}
   245 
   251