100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

COS1512 Assignment 3 (COMPLETE ANSWERS) 2025 - DUE 4 August 2025

Rating
-
Sold
-
Pages
9
Grade
A+
Uploaded on
04-08-2025
Written in
2025/2026

Question 1 Write a program that asks a user to enter the size of a dynamic array that stores exam marks obtained by students. Create the dynamic array and a loop that allows the user to enter an exam mark into each array element. Loop through the array, find the average mark for the exam and output it. Delete the memory allocated to your dynamic array before exiting your program. Question 2 Write a program to determine the tuition fees for a student. The program should use two overloaded functions, each named calcFees, to determine the tuition fees for a student. Students who repeat a module pay a different fee for the modules which are repeated. The program should first ask if the student repeats any modules. If the student repeats, the program should ask for the number of modules which are repeated. One of the overloaded functions should accept the number of modules enrolled for the first time and the fee for those modules as arguments (parameters), while the other function accepts arguments for the number of modules enrolled for the first time and the fee for those modules as well as the number of modules repeated and the fee for those modules. Both functions should return the tuition fees for the student.

Show more Read less









Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
August 4, 2025
Number of pages
9
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

COS1512 Assignment 3
(COMPLETE ANSWERS)
2025 - DUE 4 August 2025

For assistance contact
Email:

, //
=====================================================================
====
// Question 1: Dynamic Array for Exam Marks
// This program asks the user for the size of a dynamic array,
// populates it with exam marks, calculates the average, and then
// properly deallocates the memory.
//
=====================================================================
====


#include <iostream>


int main() {
int arraySize;


// Ask the user for the size of the dynamic array
std::cout << "Enter the number of students (array size): ";
std::cin >> arraySize;


// Validate the input to ensure a positive size
if (arraySize <= 0) {
std::cout << "Array size must be a positive number. Exiting program." << std::endl;
return 1;
}


// Create the dynamic array using 'new'
int* examMarks = new int[arraySize];
long long totalMarks = 0;

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
gabrielmusyoka940 db
View profile
Follow You need to be logged in order to follow users or courses
Sold
1457
Member since
2 year
Number of followers
247
Documents
1488
Last sold
1 week ago
Bstudy

provides latest exam paper

3,2

214 reviews

5
68
4
28
3
49
2
20
1
49

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 exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

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

Student with book image

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

Alisha Student

Frequently asked questions