Question: 2. Design and implement a Name pairs class holding (name age) pairs where name is a string and age is a double Represent that as

 2. Design and implement a Name pairs class holding (name age)

2. Design and implement a Name pairs class holding (name age) pairs where name is a string and age is a double Represent that as a vector (called name) and a vector (called age) member. Provide an input operation read names() that reads a series of names. Provide a read ages0 operation that prompts the user for an age for each name. Provide a print0 operation that prints out the (namelil,agelil) pairs (one per line) in the order determined by the name vector. Provide a sort0 operation that sorts the name vector in alphabetical order and reorganizes the age vector to match. Implement all "operations" as member fiunctions. Test the class (of course: test early and often) 3. Replace Name pair::print0 with a (global) operator

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!