Create a class named Student that has three member variables:
• name – A string for the name of the student.
• numClasses – An integer for how many courses the student is currently enrolled in.
• classList – An array of strings for the names of the classes the student is enrolled in.
Write appropriate constructor(s), mutator (set), and accessor (get) methods for the class
along with the following:
• A function that inputs all values from the user, including the list of class names.
• A function that outputs the name and list of all courses.
• A function that resets the number of classes to 0 and the classList to an empty array
(with null strings).
The main() should test all of these functions. It should perform the following steps in a loop:
• It should ask the user to input a students data.
• Display the entered data back (in a well-formatted way).
• Ask the user if they want to enter the data again (y/n).
1• If ’n’, then the program ends, otherwise it should clear the student class object and
repeat the loop (ask the user to enter new data…).
Note: The statement ‘cin >> variable;’ leaves a newline character in the buffer. This can be
a problem if you are mixing ‘cin >> variable;’ and the ‘getline’ function (that reads a line
of input). Use ‘cin.ignore’ function to discard the newline character after using ‘cin’.
Write a Review
Leave a reply Cancel reply
Ask Your Question
We have verified professionals who are ready to answer your question.
Save Time and Money
We choose experts who can quickly answer your question and that suit your budget.
Get Your Answer
Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.