Question: In C + + PLEASE The program first reads integer memberCount from input, representing the number of pairs of inputs to be read. Each pair
In C PLEASE
The program first reads integer memberCount from input, representing the number of pairs of inputs to be read. Each pair has a
string and an integer, representing the member's name and age, respectively. One Member object is created for each pair and
added to vector memberList. Write the FindAverageMemberAge function in the Appointments class to return the average age of
all the Member objects as an integer.
Ex: If the input is:
Pat Noa Ada Eli
then the output is:
Average member age:
Note: The ArrayList has at least one element. #include
#include
using namespace std;
class Member
public:
void SetNameAndAgestring newName, int newAge;
int GetAge const;
private:
string name;
int age;
;
void Member::SetNameAndAgestring newName, int newAge
name newName;
age newAge;
int Member::GetAge const
return age;
class Appointments
public:
void InputMembers;
int FindAverageMemberAge;
private:
vector memberList;
;
void Appointments::InputMembers
Member currMember;
string currName;
int currAge;
int memberCount;
unsigned int i;
cin memberCount;
for i ; i memberCount; i
cin currName;
cin currAge;
currMember.SetNameAndAgecurrName currAge;
memberList.pushbackcurrMember;
Your code goes here
int main
Appointments appointments;
appointments.InputMembers;
cout "Average member age: appointments.FindAverageMemberAge endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
