2023
COS1512
Assignment 2
(762913)
DUE: 3 July 2023
CUT-OFF DATE: 6 July 2023
UnisaGuides
, Disclaimer
The study notes provided herein are intended to assist students in their academic endeavours and
provide guidance based on assignments. However, it is important to understand and acknowledge
the following points before utilizing these study notes:
1. Educational Aid: These study notes are designed to serve as educational aids and should not be
considered as a substitute for individual research, critical thinking, or professional guidance. Students
are encouraged to conduct their own extensive research and consult with their instructors or
academic advisors for specific assignment requirements.
2. Personal Responsibility: While every effort has been made to ensure the accuracy and reliability of
the information provided in these study notes, the seller cannot guarantee the completeness or
correctness of all the content. It is the responsibility of the buyer to verify the accuracy of the
information and use their own judgment when applying it to their assignments.
3. Academic Integrity: It is crucial for students to uphold academic integrity and adhere to their
institution's policies and guidelines regarding plagiarism, citation, and referencing. These study notes
should be used as a tool for learning and inspiration, but any direct reproduction of the content
without proper acknowledgment and citation may constitute academic misconduct.
4. Subject Variation: The study notes may not cover all possible variations or interpretations of a
subject matter. Different institutions, professors, or courses may have specific requirements or
perspectives that are not addressed in these notes. Therefore, it is essential for students to tailor
their assignments according to their unique academic environment.
5. Limited Liability: The seller of these study notes shall not be held liable for any direct or indirect
damages, losses, or consequences arising from the use of the notes. This includes, but is not limited
to, poor grades, academic penalties, or any other negative outcomes resulting from the application
or misuse of the information provided.
By purchasing and utilizing these study notes, you acknowledge that you have read, understood, and
agreed to the above disclaimer. It is recommended to review the disclaimer periodically, as it may be
subject to updates or revisions without prior notice.
,This document contains:
1. The copiable code + screenshots for all 7 questions of COS1512 Assignment 2 2023
2. Google drive link on last page of this document. Simple download and run the project on
your own computer
,Output:
,Copiable Code Below:
, #include <iostream>
using namespace std;
// Function overload for calculating fees without repeat modules
int calcFees(int num_modules, int module_fee) {
return num_modules * module_fee;
}
// Function overload for calculating fees with repeat modules
int calcFees(int num_modules_new, int module_fee_new, int
num_modules_repeat, int module_fee_repeat) {
int total_fee = (num_modules_new * module_fee_new) +
(num_modules_repeat * module_fee_repeat);
return total_fee;
}
int main() {
string repeat_modules;
cout << "Are you repeating any modules? (yes/no): ";
cin >> repeat_modules;
if (repeat_modules == "yes") {
int num_modules_repeat;
cout << "Enter the number of modules repeated: ";
cin >> num_modules_repeat;
int module_fee_new, module_fee_repeat;
cout << "Enter the fee for modules taken for the first time: ";
cin >> module_fee_new;
cout << "Enter the fee for repeated modules: ";
cin >> module_fee_repeat;
int total_fee = calcFees(num_modules_repeat, module_fee_repeat);
cout << "Total tuition fees: " << total_fee << endl;
}
else {
int num_modules_new;
cout << "Enter the number of modules taken for the first time:
";
cin >> num_modules_new;
int module_fee_new;
cout << "Enter the fee for modules taken for the first time: ";
cin >> module_fee_new;
int total_fee = calcFees(num_modules_new, module_fee_new);
cout << "Total tuition fees: " << total_fee << endl;
}
return 0;
}