Design and implement a Name_pairs class holding (name,age) pairs where name is a string and age is
Question:
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_ages() operation that prompts the user for an age for each name. Provide a print() operation that prints out the (name[i],age[i]) pairs (one per line) in the order determined by the name vector. Provide a sort() operation that sorts the name vector in alphabetical order and reorganizes the age vector to match. Implement all “operations” as member functions. Test the class (of course: test early and often).
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 44% (9 reviews)
C Program include include include using namespace std class ...View the full answer
Answered By
Joash Mokaya
I am an experienced tutor with more than 7 years of experience. I have helped thousands of students pursue their academic goals. My primary objective as a tutor is to ensure that students have an easy time handling their academic tasks.
0.00
0 Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
In this project, we will make up a banking system. You are an employee of MadeUp Banking. Your job is to manage multiple bank accounts. Here, you would create new accounts, deposit to an account,...
-
Design and implement a C++ class called Module that handles information regarding your assignments for a specific module. Think of all the things you would want to do with such a class and write...
-
Design the door class which has the property of either open or shut. The door can also be opened and shut. Design another special type of door class called lockable door. Lockable door is like a...
-
is an acute angle such that tan() =1/3. What is the value of 1010. (sin + cos)? 3.
-
Rearrange the equation to solve for the indicated unknown. a. 7 .5b+2.5 Solve for b: b. 64 4 c. 3a .25V Solve for c: Solve for a:
-
Griffin Companys inventory records for its retail division show the following at December 31: At December 31, 11 of these units are on hand. Journalize the following for Griffin Company under the...
-
Use the data set, which represents the ages of 30 executives. Which ages are below the 75th percentile? 43 57 65 47 57 41 56 53 61 54 56 50 66 56 50 61 47 40 50 43 54 41 48 45 28 35 38 43 42 44
-
Ontario, Inc.s inventory records for a particular development program show the following at January 31: At January 31, eight of these programs are on hand. Journalize the following for Ontario, Inc:...
-
2. Define "perfect competition" and "monopoly." Besides wheat, list three other products or services that have markets like perfect competition. List three products or services that have markets like...
-
Your brother has just started a new job as the Controller of an IESBA restricted audit client. You do not serve on the audit engagement. What steps must you take to ensure your independence is not...
-
List sets of plausible operations for the examples of real-world objects in 9.1 (such as toaster).
-
Replace Name_pair::print() with a (global) operator < < and define == and != for Name_pairs.
-
As mentioned in solved problem S2, origins of transfer can be located in many different locations, and their direction of transfer can be clockwise or counterclockwise. Let's suppose a researcher...
-
Which statement about the following program is true? A. An exception is printed at runtime with Call in the message. B. An exception is printed at runtime with Voicemail in the message. C. An...
-
Given an application that hosts a website, which of the following would most likely result in a java.lang.Error being thrown? (Choose two.) A. A user tries to sign in too many times. B. Two users try...
-
What is the result of compiling and running the following application? A. java.lang.IllegalArgumentException is printed. B. The code does not compile because of line h1. C. The code does not compile...
-
What is the output of the following application? A. 1235 B. 3215 C. 5123 D. 5321 E. The code does not compile. F. None of the above. package vortex; class TimeException extends Exception {} class...
-
What is the output of the following application? A. 12 B. 21 C. The code does not compile because of the MyDatabase nested class. D. The code does not compile because of the try-with-resources...
-
What fact-finding methods are well-suited for complex technical issues? Which might be appropriate for the pursuit of new, cutting - edge features?
-
Explain the term global capital markets. This chapter primarily discusses global equity markets. What other types of financial instruments are traded in these markets? How important are global...
-
Referring to the CRC-32 polynomial in Table 10.4, answer the following questions: Table 10.4 a. Does it detect a single error? Defend your answer. b. Does it detect a burst error of size 16? Defend...
-
Referring to the CRC-8 polynomial in Table 10.7, answer the following questions: a. Does it detect a single error? Defend your answer. b. Does it detect a burst error of size 6? Defend your answer....
-
Which of the following CRC generators guarantee the detection of a single bit error? a. x 3 + x + 1 b. x 4 + x 2 c. 1 d. x 2 + 1
-
A manufacturer reports finished goods inventory of $820 on June 1 and $1,130 on June 30. Cost of goods manufactured for June is $5,460. What is cost of goods sold for June? Cost of Goods Sold Cost of...
-
Stacey's Piano Rebuilding Company has been operating for one year. At the start of the second year, its income statement accounts had zero balances and its balance sheet account balances were as...
-
MyBnB started a home rental company on January 1. As of November 30, MyBnB reported the following balances. The company does not yet have a balance in Retained Earnings because this is its first year...
Study smarter with the SolutionInn App