COS1512 - Introduction To Programming II (COS1512)
Exam (elaborations)
Feedback for assignment 2 year 2022
6 views 0 purchase
Course
COS1512 - Introduction To Programming II (COS1512)
Institution
University Of South Africa (Unisa)
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.
COS1512 - Introduction To Programming II (COS1512)
All documents for this subject (51)
Seller
Follow
lindelanitshikalange0
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:
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller lindelanitshikalange0. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $4.25. You're not tied to anything after your purchase.