Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 1 out of 4 pages
Exam (elaborations)

Feedback for assignment 2 year 2022

Document preview thumbnail
Preview 1 out of 4 pages

This is a feedback for assignment 3 provided by the lecturer. The document describes how the assignments is supposed to be tackled with indebt explanations and key example.

Content preview

COS1512 Feedback on Assignment 2

Dear COS1512 Student

Your marked Assignment 2 has been released, and you should be able to see the feedback and the
results. Please check the feedback files for feedback on your assignment. The solution to the
assignment has been release a while ago, but I attach an updated version. Please use the updated
version if you want to see what was expected.

Not everyone submitted, which is a pity, since doing the assignments is an important part of
mastering the study material, and also contributes to your year mark, which in turn contributes 20%
to your final mark.

If you have not submitted Assignment 2, please do your best to submit Assignments 3 and 4.

This is a long e-mail/announcement because I provide some general feedback on issues I picked up
while we marked Assignment 2. I will do it question by question. Even if you have not done the
assignment, you should benefit from the feedback. And if you did not do question 8, have a look at
the feedback other students provided for this question. Maybe you can learn something from it.

Question 1

When we overload a function, we have two or more functions with the same name, but a different
number of parameters, or with different types of parameters in the program. Most students could
do this question.

Question 2

The purpose of question 2 was to allow you to practise using the assert() function. If you did not
use the assert() function in your answer, you would not have received full marks for this
question.

I noticed that some students are not clear on how to use non-void functions (i.e. functions that
return values) and reference parameters. If you use a non-void function, e.g. a function with the
following header
double calcDiscount (double price, double discount, bool fixed)

it means that the function must include a statement to return a value, e.g.
return price;

Then the following header
double calcDiscount (double & price, double discount, bool fixed)

would not be appropriate since it would return the modified price through the reference parameter.

On the other hand, if your function is a void function with a reference parameter, such as the header
below
void calcDiscount (double & price, double discount, bool fixed)

modifying the price inside the function would be enough to return the new value for the price.

The header below, however, will not allow the function to return any value to the main program:

Document information

Uploaded on
October 11, 2022
Number of pages
4
Written in
2021/2022
Type
Exam (elaborations)
Contains
Questions & answers
$4.80

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
5
Followers
4
Items
14
Last sold
3 year ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions