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

Problem: The Sangree Old Folks Home is in deep financial trouble and the owner,

ID: 3880477 • Letter: P

Question

Problem: The Sangree Old Folks Home is in deep financial trouble and the owner, old Doc's Sangree decides to go on a massive fundraising campaign. The local high school offers to help by sponsoring a dance marathon. Old Doc Sangree would like you to write a program to process the data gathered on the couples who will dance and their sponsors. Input: y couple that dances is given a unique ID 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: ID HRS Rate 0.80 2.00 3.40 2.25 1.00 0.65 1.50 4.00 10.00 4.50 3.75 4.75 141 161 6 141 132 141 141 161 132 157 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) The third number is a real value which gives the dollar per hour amount that the sponsor will donate (RATE).

Explanation / Answer

#include <iostream>

using namespace std;

int main() {

// your code goes here

int n,temp,temp1,temp2,largest;

int a[100],b[100];

float c[100];

cout<<"Enter the number of data to be entered";

cin>>n;

for(int i =0;i<n;i++)

{

cout<<" enter the ID and HRS and Rate per hour";

cin>>a[i]>>b[i]>>c[i];

}

for(int i=0;i<n;i++)

{

for(int j=0;j<n-1;j++)

{

if(a[j]>a[j+1])

{

temp=a[j];

temp1=b[j];

temp2=c[j];

a[j]=a[j+1];

b[j]=b[j+1];

c[j]=c[j+1];

a[j+1]=temp;

b[j+1]=temp1;

c[j+1]=temp2;

}

}

}

cout<<"Sorted ascending order array: ";

cout<<"ID "<<"HRS "<<"rate"<<endl;

for(int i=0;i<n;i++)

{

cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<endl;

}

for(int i =0;i<n;i++)

{

c[i] = b[i]*c[i];

}

cout<<" the total number of rate for each unique ID ";

cout<<"ID "<<"HRS "<<"rate"<<endl;

for(int i =0;i<n;i++)

{

cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<endl;

}

cout<<"the couple who earns most ";

cout<<"ID "<<"HRS "<<"rate"<<endl;

largest = c[0];

for (int i = 1; i < n; i++)

{

if (largest < c[i])

largest = c[i];

}

for (int i = 1; i < n; i++)

{

if(c[i] == largest)

{

cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<endl;

}

}

return 0;

}

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