EC7103 – C++ Programming for Finance – Coursework 2

Consider an investment project with an initial investment of X pounds and fixed (positive) cash flow of C pounds every year for the next n years. The internal rate of return (IRR) is the value of r that makes the net present value of the investment equal zero, satisfying the following relationship:

In this coursework you will have to write a programme to calculate the IRR using three different algorithms covered in the module. Your programme must have the following components:

1. You must ask the user to provide all the information required for the programme to work.
2. You must use calculate the IRR using the secant method, the bisection method, and Newton-Raphson method.
3. The objective function of these algorithms must be programmed as a separate function.
4. Once finished, you must show the user the value of the IRR calculated using each of the algorithms, and at least the number of iterations of each algorithm until convergence. You can show the user other information that you find relevant.
5. Based on your results, comment which algorithm you would prefer, and provide a reason for your choice. Write this directly as comments on your cpp file.

You must upload your source file (file with extension .cpp) to Turnitin by the day and time indicated in the coversheet. This the second of the three pieces of coursework that you should submit during the semester. This coursework is worth 25% of your total mark to the module.

Getting Started!

You can use the examples in the lectures and seminars as starting point and reference to understand the use of the tools needed to solve this coursework. You can explore the methods a little further in the following textbooks:

• Hull, J., 2012, Options, futures and other derivatives, eighth edition, Pearson.
• Hull, J., 2015, Risk management and financial institutions, fourth edition, Wiley
• M.J. Capinski and T. Zastawniak (2012), Numerical Methods in Finance with C++. Cambridge University Press.
• J. Duffy (2004), Financial Instrument Pricing Using C++. Wiley Finance.