The main program calls a function to read in a set solved

$25.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (4 votes)

The main program calls a function to read in a set of people’s three-digit ID numbers and their donations to a charity. The main program calls a function to sort the ID numbers into numerical order, being sure to carry along the corresponding donations. (See Exercise 45.) The main program calls a function to print the sorted lists, giving both ID numbers and donations. The main program also calls a function to sort the donation amounts into ascending order, carrying along the corresponding ID numbers. Print the sorted lists, giving both ID numbers and donations.

Here are the details:

(a) The main program calls a function to read in the data. The data set consists of a parameter value which the main program calls n and n groups of data, each of which contains a person’s three-digit ID number and an integer (e.g., 456 20000 or 123 30234).

The main program calls these arrays idnumbers and donations. A separate printing function prints the original set of data in the form of a neat table. When the arrays print, there should be an overall heading, plus headings for the columns of ID numbers and donations.

(b) Then the main program sends the array of ID numbers, the array of donations, and the size n to a sorting function. This function sorts the ID numbers into numerical order. Be sure to maintain the matchup of ID numbers and donations. For example, 456 should always be associated with 20000, no matter where 456 moves in numerical order; similarly, 123 should stay with 30234.

When the sorting function finishes and returns control to the main program, it calls the printing function to print the two arrays.

(c) Next the main program sends the same three parameters to the sorting function, which sorts the donations into numerical order, being sure to maintain the linkup of ID numbers and donations.