Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please answer in C++ 3 Average donation Sarah and Kelly are devoted to donating to several different causes. Both want to receive the prize for
Please answer in C++
3 Average donation Sarah and Kelly are devoted to donating to several different causes. Both want to receive the prize for the "number 1 donor of the department" they work in. The rules for the prize specify that the winner will be the donor with the maximum average donation, as long as some conditions are satisfied: 1. the winner must have donated to at least 5 different causes; 2. the total amount donated is at least 300 dollars. If the average is the same, the winner is the one with most donations. Sarah and Kelly want to compare their donations to determine who among them would win the prize (if any). They each record their total donation to each cause (as non-negative integer values) in a file. For the donations below, Sarah wins Sarah: 100 200 50 100 100 51 Kelly: 100 100 100 100 100 100 100 100 For the donations below, Kelly wins Sarah: 500 700 Kelly: 50 100 50 50 50 For the donations below, no one qualifies for the prize Sarah: 10 200 50 10 10 5 Kelly: 1000 For the donations below, they tie Sarah: 100 200 50 100 100 50 Kelly: | 10 | 130 50 140 80 190 Your task in this problem is to write a function void bestDonor(string kellyDonationsFile, string sarahDonationsFile) that takes as input the names of the files containing their donation records and prints the outcome: either Sarah or Kelly wins, they tie, or they do not qualify for the prizeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started