Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can someone help me write this code please. I tried but I am not getting it right. The Sangree Old folks Home is in deep

can someone help me write this code please. I tried but I am not getting it right. image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
The Sangree Old folks Home is in deep financial trouble and the owner, old Doc's Sanerer. decides to go on a massive fundralsing campaigh. The local high schoel eflers to bete by spensoring a dance marathen. Old Doc Sangree would like you to write a proeram to procens the data gathered on the couples who will dance and their sponsors. Input: Every couple that dances is given a unique io number. Each sponsor is asked how much they are willing to donate for each hour the couple dances and the maximum number of hours they are willing to pay for. Data: a) The first number is the ID number of the couple being sponsored (iD) b) The second number represents the maximum number of hours the sponsor is willing to pay for (HRS) c) The third number is a real value which gives the dollar per hour amount that the sponsor will donate (RATE). Output: The old Doc would appreciate it if you printed out the following intormation: a. Pead the input one at a time into an array of objects. b. Sort the arrays in ascending order by couple ID; if there are ieveral io's the same, the one with higher dollar per hour pledged should be first; print these assorted arrays (print ID, HASs, Rate). c. Print an integer count for the number of sponsors followed by an integer count for the real number of couples, and then the real value which represents the total amount of money that will be collected (assuming all couples dance the maximum number of hours). Print theses three numbers on cne line. The Old Doc would appreciate it if you printed out the following information: a. Read the input one at a time into an array of objects. b. Sort the arrays in ascending order by couple ID; if there are several ID'S the same, the one with higher dollar per hour pledged should be first; print these assorted arrays (print ID, HRS, Rate). c. Print an integer count for the number of sponsors followed by an integer count for the real number of couples, and then the real value which represents the total amount of money that will be collected (assuming all couples dance the maximum number of hours). Print theses three numbers on one line. d. Print out each unique 10 number, the total number of sponsors for that iD, and the total amount the couple will collect (again assuming they all dance long enough to collect the full amount pledged). Print these three values on one line for each Unique ID. (These should already be sorted by ID). e. Find the couple who will earn the most money (if they all dance long enough), then print that couple's ID, the number of sponsors they have, and the total amount they will collect. Print these three rumbers on the line. f. All output should start with proper heaciings. g. Proper internal documentation. - MUST use the concept of Object Oriented Programming in implementing the program. - Must submit the following with all documents stapled. a. Documented program b. Raw Input file c. Documented outputs based on the items 1 through 6 as mentioned in the Output to an output file. class dancer \{ int id, hrs; float rate; public: dancer(); void read_val(ifstream \&); void print_val(ofstream \&); void sort_by_id(dancer a[], int); void sort_by_rate(dancer a[], int); int couple_counter(dancer a[], int); // Total amount earned by EAcH couple and the // number of sponsors void u_id(dancer a[], ofstream \&); // Money earned from each performance. float get_earnings(dancer a[], int); int get_id(); int get_hrs(); float get_rate(); // Total money earned by ALL dancers float total_raised(dancer a[]); void swap(int, int, dancer a[]); Sorted List: 1171171171321321411411411411571611615533352214640.8/h12.251.53.750.6524104.753.44.5 12. Sponsors 5 couples $114.15 total earned . 117:3SPONSORS,$15.75132:2SPONSORS,$15.75141:4SPONSORS,$25.25157:1SPONSORS,$19.00161:2SPONSORS,$38.40 Couple with most money is: 161 with 2 sponsers, earning $38.40

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

' Do you see any objectives that appear to be contradictory?

Answered: 1 week ago