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
Exam (elaborations)

Feedback for assignment 2 year 2022

Rating
-
Sold
-
Pages
4
Grade
B
Uploaded on
11-10-2022
Written in
2021/2022

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.

Institution
Course

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:

Written for

Institution
Course

Document information

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

Subjects

$4.74
Get access to the full document:

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

Get to know the seller
Seller avatar
lindelanitshikalange0

Get to know the seller

Seller avatar
lindelanitshikalange0 University of South Africa (Unisa)
Follow You need to be logged in order to follow users or courses
Sold
5
Member since
3 year
Number of followers
4
Documents
14
Last sold
3 year ago

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

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

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right 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 aced 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