Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In c++, only solution code pls thank u The program first reads integer certificateCount from input, representing the number of pairs of inputs to be

In c++, only solution code pls thank u

The program first reads integer certificateCount from input, representing the number of pairs of inputs to be read. Each pair has a string and an integer. One Certificate object is created for each pair and added to vector certificateList. Write the PrintCertificatesInRange() function in the RecordsManager class using Print() to output all the Certificate objects with level between 4 and 8, both inclusive.

Ex: If the input is:

5 Rob 4 Jan 2 Dan 8 Ana 10 Eve 1

then the output is:

Certificate: Rob, Level: 4 Certificate: Dan, Level: 8

Note: The vector has at least one element.

#include #include using namespace std; class Certificate { public: void SetHolderAndLevel(string newHolder, int newLevel); int GetLevel() const; void Print() const; private: string holder; int level; }; void Certificate::SetHolderAndLevel(string newHolder, int newLevel) { holder = newHolder; level = newLevel; } int Certificate::GetLevel() const { return level; } void Certificate::Print() const { cout << "Certificate: " << holder << ", Level: " << level << endl; } class RecordsManager { public: void InputCertificates(); void PrintCertificatesInRange(); private: vector certificateList; }; void RecordsManager::InputCertificates() { int certificateCount; unsigned int i; Certificate currCertificate; string currHolder; int currLevel; cin >> certificateCount; for (i = 0; i < certificateCount; ++i) { cin >> currHolder; cin >> currLevel; currCertificate.SetHolderAndLevel(currHolder, currLevel); certificateList.push_back(currCertificate); } } /* Your code goes here */ int main() { RecordsManager recordsManager; recordsManager.InputCertificates(); recordsManager.PrintCertificatesInRange(); return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions

Question

Discuss consumer-driven health plans.

Answered: 1 week ago