Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Examen

COS 1512 ASSIGNMENT 3 2023.

Puntuación
-
Vendido
-
Páginas
7
Grado
A+
Subido en
16-08-2023
Escrito en
2023/2024

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

Institución
Grado

Vista previa del contenido

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.

Escuela, estudio y materia

Institución
Grado

Información del documento

Subido en
16 de agosto de 2023
Número de páginas
7
Escrito en
2023/2024
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

$3.00
Accede al documento completo:

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
tutorburton4 Walden University
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
34
Miembro desde
3 año
Número de seguidores
26
Documentos
196
Última venta
1 mes hace
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 reseñas

5
2
4
0
3
1
2
1
1
4

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes