ASSIGNMENT 2
SEMESTER 2
2022
, COS1512 Assignment 2 Semester 2
UNIQUE NUMBER
DUE DATE:
TUTORIAL MATTER: Chapters 10, 11, 12 and 15 of the Study
Guide (Tutorial Letter 102 available under
Additional Resources on the COS1512
website on myUnisa )
Chapters 10, 11, 12 (excluding “Creating a
Namespace”) and 15 (only 15.1 “Inheritance
basics”) in Savitch
Appendices 7 and 8 in Savitch
WEIGHT: 80%
Question 1
Consider the following structure used to keep record of a meeting:
struct Meeting
{
string speaker;
string topic;
string venue;
string date;
}
Turn the meeting struct into a class. The class should have member variables for
all the values in the corresponding struct. Make all member variables private.
Include public member functions for each of the following:
a default constructor that sets the string data members to blank strings;
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);
Test the class in a program that instantiates an object of classMeeting (i.e. ‘declare’
an object of ‘type’ Meeting). The program should then input values for the object
(obtained from the keyboard), and use the mutators to assign values to the member
variables. Use the accessors to obtain the values of the member variables of the object
and display those values on the screen. Test your program with appropriate input.