Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include using namespace std; class Patient { public: void SetNameAndAge(string newName, int newAge); int GetAge() const; void Print() const; private: string name; int age;

image text in transcribed

#include #include using namespace std;

class Patient { public: void SetNameAndAge(string newName, int newAge); int GetAge() const; void Print() const; private: string name; int age; };

void Patient::SetNameAndAge(string newName, int newAge) { name = newName; age = newAge; }

int Patient::GetAge() const { return age; }

void Patient::Print() const { cout

int main() { int patientCount; unsigned int i; vector patientList; Patient currPatient; string currName; int currAge;

cin >> patientCount; for (i = 0; i > currName; cin >> currAge; currPatient.SetNameAndAge(currName, currAge); patientList.push_back(currPatient); }

/* Your code goes here */

return 0; }

Jump to level 1 The program first reads integer patientCount from input, representing the number of pairs of inputs to be read. Each pair has a string and an integer. One Patient object is created for each pair and added to vector patientList. If a Patient object's age is between 27 and 61 , both inclusive, call the Patient object's Print(). Ex: If the input is: 4 Jan 87Tim25 Ina 27 Mel 61 then the output is: Patient: Ina, Age: 27 Patient: Mel, Age: 61 Note: The vector has at least one element

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

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions

Question

Have you ever been arrested for a crime?

Answered: 1 week ago

Question

Does an equimolar mixture of A and B have optical activity? Why?

Answered: 1 week ago

Question

Does it have at least one-inch margins?

Answered: 1 week ago

Question

Does it highlight your accomplishments rather than your duties?

Answered: 1 week ago