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

COS 1512 ASSIGNMENT 3 2023.

Rating
-
Sold
-
Pages
7
Grade
A+
Uploaded on
16-08-2023
Written in
2023/2024

COS 1512 ASSIGNMENT 3 2023. COS 1512 ASSIGNMENT 3 2023.










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

Document information

Uploaded on
August 16, 2023
Number of pages
7
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

COS 1512
ASSIGNMENT 3 2023.


DUE DATE: 21 August 2023
CUT-OFF DATE: 24 August 2023

TUTORIAL MATTER:
Chapters 10, 11, 12 and 15 of the Study
Guide (Appendix D)

Chapters 10, 11, 12 (excluding “Creating a
Namespace”)
Appendices 7 and 8 in Savitch
None
EXTENTION:

WEIGHT: 40%



Question 1
Consider the following structure used to keep employee records:
struct Employee
{
string firstName;
string lastName;
float salary;
}


Turn the employee record into a class type rather than a structure type. The employee
record class should have private member variables for all the data. Include public
member functions for each of the following:
• a default constructor that sets the employee‘s first name and last name to a blank
string, and his annual salary to 0;
• an overloaded constructor that sets the member variables to specified values;
• member functions to set each of the member variables to a value given as an
argument to the function (i.e. mutators);
• member functions to retrieve the data from each of the member variables (i.e
accessors);

Embed your class definition in a test program. The test program should create two
Employee objects and display each object’s annual salary. Use the overloaded
constructor to initialise one of the Employee records as Joe Soap with an annual salary
of R145600.00. Obtain the following input values for the other Employee record from
the keyboard:
Joanne Soape
R154460.66

, Now give each employee a 10% raise and display each Employee object’s annual
salary again.


Quesion 2
Design and implement a C++ class called Module that handles information regarding
your assignments for a specific module. Think of all the things you would want to do
with such a class and write corresponding member functions for your Module class.
Your class declaration should be well-documented so that users will know how to use
it.
At a minimum your class Module should contain information on the module code, the
module name, the marks for assignments, the year mark and the final mark.
Test your class in a small program where you instantiate an object of the class,
initialize the member variables that represents the assignment marks, calculate a year
mark and display the year mark.


Quesion 3
Implement your class Module from question 2, as an abstract data datatype (ADT)
using separate compilation, so that separate files are used for the interface and
implementation.
Write a main program that does the following:

• Declare an array of all your modules. The elements of the array must be of
objects of the class Module.
• Initialise the array with the modules you are registered for. Obtain the module
codes, names of modules and assignment marks from the user. Initialise each
module with the assignment marks you have obtained for the module (or would
like to obtain for the module).
• Determine your semester mark for each module: the first assignment
contributes 30% and the second assignment 70%. Display the semester marks.
• Adjust the marks for Assignment 2 for COS1512 with +5%.
• Determine your semester mark for COS1512 again to see what effect the
update had.
• Display an updated list of your semester marks for all the modules you are
registered for.


Enrichment exercise:
Adapt the application program to use a vector instead of an array. It should not
be necessary to change the class interface or implementation file in any way.

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.
tutorburton4 Walden University
View profile
Follow You need to be logged in order to follow users or courses
Sold
32
Member since
2 year
Number of followers
26
Documents
198
Last sold
6 months ago
YOUR STUDY ASSISTANT.

Here, you will find everything you need in EXAMS AND TESTBANKS. Contact us, to fetch it for you in minutes if we do not have it in this shop. You may support our work by leaving a review after purchasing any document so as to make sure our customers are 100% satisfied. wish all the best in your studies.

2,4

8 reviews

5
2
4
0
3
1
2
1
1
4

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