Question: Write the InputCertificates() function in the RecordsManager class. Within InputCertificates(), use cin to read each line number until -999 is read from input. If the

Write the InputCertificates() function in the RecordsManager class. Within InputCertificates(), use cin to read each line number until -999 is read from input. If the line number is not equal to -999, use the Certificate object's ReadHolderAndLevel() to read the certificate's holder and level from input and append the Certificate object to vector certificateList.

Ex: If the input is:

1 Ina 6 2 Fay 1 3 Ani 7 -999

then the output is:

Certificate: Ina, Level: 6

Certificate: Fay, Level: 1

Certificate: Ani, Level: 7

#include #include using namespace std;

class Certificate { public: void ReadHolderAndLevel(); void Print() const; private: string holder; int level; };

void Certificate::ReadHolderAndLevel() { cin >> holder; cin >> level; }

void Certificate::Print() const { cout << "Certificate: " << holder << ", Level: " << level << endl; }

class RecordsManager { public: void InputCertificates(); void PrintCertificates(); private: vector certificateList; }; //Enter code here void RecordsManager::PrintCertificates() { unsigned int i; Certificate currCertificate;

for (i = 0; i < certificateList.size(); ++i) { currCertificate = certificateList.at(i); currCertificate.Print(); } }

int main() { RecordsManager recordsManager;

recordsManager.InputCertificates(); recordsManager.PrintCertificates(); return 0; }

Code in C++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!