Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Hinner College Foundation holds an annual fundraiser for which the foundatio

ID: 3627675 • Letter: T

Question

The Hinner College Foundation holds an annual fundraiser for which the foundation director maintains records. Writer a program that accepts donor names and contribution amounts continuously. Assume that there are at least five donors, but never more than 300. Develop the logic for a program that sorts the donation amounts in descending order and then displays the five most generous donors and their donation amounts.

Explanation / Answer

input number of donors. for k, 0 to numDonors: input donor name and amounts into two arrays for k, 0 to numDonors: maxIndex=k for j, k+1 to numDonors: if(donation sub k > donation sub maxIndex) maxIndex=j swap donor sub k with donor sub maxIndex for k, 0 to 5: print donor name sub k + donation sub k ^^This is pseuocode for a simple descending selection sort method. Inputs the donor names and donations, and "selects" the correct value for a descending sort (meaning for each place in the array, it picks the next biggest value to put there).

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote