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: 50% (10 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:
-
20.Withanactivityflexiblebudget,abudgetvarianceiscalculated Selectone: a. basedonaflexiblebudgetbasedoncostforactualunitsproduced. b....
-
What is Project Risk Management? AppendixLO1
-
Med-Tech labs is a facility that provides medical tests and evaluations for patients, ranging from analyzing blood samples to performing magnetic resonance imaging (MRI). Average cost to patients is...
-
Question 7 of 1 6 Daves Inc. recently hired you as a consultant to estimate the company's WACC. You have obtained the following information. ( 1 ) The firm's noncallable bonds mature in 2 0 years,...
-
A thick steel sheet of area 400 cm2 is exposed to air near the ocean. After a one-year period it was found to experience a weight loss of 375 g due to corrosion. To what rate of corrosion, in both...
-
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.
-
On 1 March 19X6, C Black, Curzon Road, Stockport, sold the following goods on credit to J Booth, 89 Andrew Lane, Stockport SK1 1AA, Order No 1697: (a) Prepare the sales invoice to be sent to J Booth....
-
Finding Confidence Intervals. In Exercises 9-16, assume that each sample is a simple random sample obtained from a population with a normal distribution. Professor Evaluation Scores Listed below are...
-
Pacifico Company, a U . S . - based importer of beer and wine, purchased 1 , 7 0 0 cases of Oktoberfest - style beer from a German supplier for 4 5 9 , 0 0 0 euros. Relevant U . S . dollar exchange...
-
7.C. a. When you add two vectors you get another vector: yes or no? b. When you subtract two vectors you get another vector: yes or no? c. Given the coordinate system below where increasing numbers...
-
Problem 1 At a given instant, the position of a plane at A and a train at B are measured relative to a radar antenna at O. Determine the distance d between A and B at this instant. To solve the...
-
The Bell-Boeing V-22 Osprey tiltrotor is both an airplane and a helicopter. It's advantage is the ability to rotate its engines and rotors to vertical position for take-off, landings, and helicopter...
-
Stan purchased a $15,000 compound-interest Series S129 Canada Savings Bond on December 1, 2011. The interest rate in each year was 0.5%. What total interest did Stan receive when he redeemed the CSB...
-
Which of the companies has the lowest accounts receivable turnover in the year 20X2? a. Company A. b. Company B. c. Company C. d. CompanyD. 20X1 20X2 Credit Sales Average Receivables Balance $1.0...
-
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
-
Los datos de la columna C tienen caracteres no imprimibles antes y despus de los datos contenidos en cada celda. En la celda G2, ingrese una frmula para eliminar cualquier carcter no imprimible de la...
-
Explain impacts of changing FIFO method to weighted average method in inventory cost valuations? Explain impacts of changing Weighted average method to FIFO method in inventory cost valuations?...
-
A perpetuity makes payments starting five years from today. The first payment is 1000 and each payment thereafter increases by k (in %) (which is less than the effective annual interest rate) per...
Study smarter with the SolutionInn App