Page 1 of 4
Department of Electrical Engineering and Electronics
Investment analysis programme
Coursework name Assignment
Component weight 10%
HE Level 6
Lab location 3rd floor labs , library or personal computers/laptops
*Estimated time to finish 8-10 hours (code only)
Assessment method Individual, formal word-processed report
Submission format Online via VITAL
Submission deadline 11.59 pm on the 27th October, 2019
Late submission Standard university penalty applies
Resit opportunity None except for extenuating circumstance
Marking policy Marked and moderated independently
Anonymous marking No (the marker needs to link the code to the report)
Feedback via VITAL GradeMark® / Turnitin Feedback Studio
Expected release of marks date 10 business days from the deadline
Learning outcomes LO1: Using C++ to implement a console-based application.
*Note: This estimate may vary based on the need to debug your code. Make sure you start
working on the assignment as soon as possible.
Page 2 of 4
Design and implement a console-based C++ programme that reads a data file containing
investments for a fiscal year by investors in a company. The file template will look as follows:
Where the number of rows depends on the input file, the investment can be positive or
negative. The programme should add two extra columns to the data file after the “Current
year’s investment” column, the first added column should show the relative contribution of
the investor to the budget of that year, calculated as follows:
Current Investment of the investor R 100%
All Investments Investment = ×
The second added column should be the expected profit, which is zero for investors with
negative investment. For investors with positive investment it is given by:
Profit 0.2 (All investments) = Rinvestment∑
If the sum of all investments is not positive, the second added column will be zero for
You should write a C++ programme that implements the tasks described above. When
developing your code, you should:
– test your code for different cases with test files of your own,
– maximise the use of functions in your code,
– consider potential run-time errors and how to handle them,
– look at C++ documentation to see if there are any commands that can make your
code easier to implement.
Additionally, you should add lines to your code to measure its execution time. The start of
the counter/timer should be after the user has input the data file to the programme. The
end of the counter/timer should be the end of the programme.
Finally, you should make the programme as professional as possible.
Page 3 of 4
Every submission should consist of source file + an executable file + brief report. It must
have the student’s name and the student ID on the cover. The report does not need an
introduction or a conclusion, it must have the following sections:
• How the programme works (explain the idea of the algorithm)
• User instructions (how should the user use it)
• Testing and verification attempts
• Appendix: source code (must be in machine readable format).
Mapping the assignment to modules’ material:
Aspect Where it is covered
Creating an executable file Lecture 1
Reading and writing to a file Lecture 2, Lab session 2
Mathematical operations Lecture 3
Control structures Lecture 4
Measuring execution time of a
Writing functions Lecture 5, lab session 3
Memory management Lecture 5, lab session 3
Dealing with run-time errors Lecture 5
Handling arrays, variable sized
arrays, or vectors
Lecture 3, Lecture 5, or Lecture 10
Further reading/tutorials http://www.cplusplus.com/reference/fstream/fstream/
Page 4 of 4
(weight %) What does it mean?
Adequate / pass
Very good / Excellent
design of the
Does the programme
do what it is designed
to do? Does the
Does the programme
make a good use of
• The programme does
what it designed to do
• The use of memory is
but is working.
• Control structures are
• The code runs for a
long time to process
few lines in the data
• The programme does what it
designed to do without any
• The memory management is
• The code runs relatively fast.
Is the code well
organised? Are the
properly? Is the code
Does it use the most
suitable datatypes for
• The code shows the
steps but is difficult to
understand what it
• Poorly commented
• The naming of the
variables is arbitrary
and does not give any
idea on what the
variables are used for.
• The code is written in very
organised way that is easy to
• The code is very well
• The variable naming is
appropriate and follows
professional naming roles.
Has the code been
tested? What does
the programme do if
there is a run-time
error? What does the
code do if the input
file template is
• The code was tested
for one case only.
• The code contains
• The code has been
• Error handling has been done
professionally for a number
of potential run-time errors
and user input errors as well.
Is the report clear and
descriptive? Is it
concise? Does it have
all sections? Are the
• The report is
contains many errors.
• The length of some
inappropriate – either
too short or too long.
• The source code is
given in the appendix
but is not machine
• The report is well written,
and all the relevant
information it should contain
are clearly stated.
• The report is concise.