Question: Name FA 2 0 2 4 The Person class is depicted in Figure 1 . As indicated in the class diagram, each person object contains
Name
FA
The Person class is depicted in Figure
As indicated in the class diagram, each person object contains the PRIVATE fields ID name, and age. The data members ID and age are integers, and the name is a string. The class includes public mutators, accessors, constructors, and a toString userdefined function that returns a string indicating the fields held in the object see slides chapter
Write an app to implement the Person class. The app will create a database of Person objects. The database should be represented as vector Person
The data to create the vector is stored in the file c:tempspringfieldPeopletxt see Figure Each file record consists of id name, age, and data Caution Not each of those fields will be used to make a person instance.
Your app must include a function called printYoungPeople. This function will identify and display the persons whose age is less than the calculated average age of the sample.
Figure Class Diagram
The function's header is provided below.
void printYoungPeoplevector Person &
For instance, if you calculate the average age and it produces a value such as the printYoungPeople function will display those individuals strictly under Displaying the selected person objects must be done using the toString method.
Additional Specs.
Do not use features outside of the material covered in the text and the lectures.
Figure File springfieldPeople.txt
Each record contains ID name, age, and data.
Homer Simpson, data
Marge Simpson,data
Bart Simpson, datal
Lisa Simpson,data
Maggie Simpson, data
Abraham Simpson, data
Ned Flanders,data
Maude Flanders, data
Milhouse Van Houten, data
Nelson Muntz, data
Ralph Wiggum,data
Seymour Skinner,data
Edna Krabappel,data
Apu Nahasapeemapetilon,data
Moe Szyslak,data
Barney Gumble, data
Krusty the Clown, datal
Clancy Wiggum, data
Waylon Smithers, data
Montgomery Burns, data
Figure Sample Output
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
