Complete the flowgarithm code for the following scenario and upload into drop box Program Purpose - Professional Athletes often hire other professionals to help take care of matters for them. We will group them in four_______ categories: Lawyers, Personal Assistants, Agents, and Trainers. They all get paid a percentage of the athlete's total yearly salary. Lawyers - 10%, Personal Assistants - 3%, Agents - 7%, and Trainers - 5% . Prompt the user to enter the athlete’s salary for the year (ensure that the entered value is positive). The user should then enter the name and category of each of the hired professionals. The athlete should be able to hire at most 20 professionals in each category as he/she wants, even if it is more than he/she can afford. Based on the category, calculate the amount that each professional should be paid. After all data has been entered, print the names of each professional hired, how much each is being paid, the total amount the athlete paid, and how much the athlete has left. 1. declare variables to store athlete info 2. declare 2 parallel arrays- one to hold the names of professionals hired and another to store the earnings of the professionals. 3. declare counters as needed to keep track of hired individuals. 4. once data is read find the total spent and remaining salary of the athlete. You can display the array contents to show who are hired as well as their salaries.
Complete the flowgarithm code for the following scenario and upload into drop box Program Purpose - Professional Athletes often hire other professionals to help take care of matters for them. We will group them in four_______ categories: Lawyers, Personal Assistants, Agents, and Trainers. They all get paid a percentage of the athlete's total yearly salary. Lawyers - 10%, Personal Assistants - 3%, Agents - 7%, and Trainers - 5% . Prompt the user to enter the athlete’s salary for the year (ensure that the entered value is positive). The user should then enter the name and category of each of the hired professionals. The athlete should be able to hire at most 20 professionals in each category as he/she wants, even if it is more than he/she can afford. Based on the category, calculate the amount that each professional should be paid. After all data has been entered, print the names of each professional hired, how much each is being paid, the total amount the athlete paid, and how much the athlete has left.
1. declare variables to store athlete info
2. declare 2 parallel arrays- one to hold the names of professionals hired and another to store the earnings of the professionals.
3. declare counters as needed to keep track of hired individuals.
4. once data is read find the total spent and remaining salary of the athlete. You can display the array contents to show who are hired as well as their salaries.
The source code of the program
// include header file
#include<bits/stdc++.h>
using namespace std;
// main function
int main()
{
double salary;
cout<<"Enter the salary of athlete: ";
cin>>salary;
string strname[100];
double income[100];
int count=0;
double totalpercent=0;
double totalpaid=0;
while(true)
{
string name;
cout<<"Enter the name of professional or q to quit: ";
cin>>name;
if(name=="q")
{
break;
}
strname[count]=name;
int temp;
cout<<"Choose the category"<<endl;
cout<<"categories: 1.Lawyer, 2.Personal Assistant, 3.Agent, 4.Trainer"<<endl;
cin>>temp;
if(temp==1)
{
if(totalpercent+10<=100)
{
totalpercent+=10;
double temp1=(salary*10/100);
totalpaid+=temp1;
income[count]=temp1;
}
else
{
cout<<"----Athlete cant afford---"<<endl;
continue;
}
}
if(temp==2)
{
if(totalpercent+3<=100)
{
totalpercent+=3;
double temp1=(salary*3/100);
totalpaid+=temp1;
income[count]=temp1;
}
else
{
cout<<"----Athlete cant afford---"<<endl;
continue;
}
}
if(temp==3)
{
if(totalpercent+7<=100)
{
totalpercent+=7;
double temp1=(salary*7/100);
totalpaid+=temp1;
income[count]=temp1;
}
else
{
cout<<"----Athlete cant afford---"<<endl;
continue;
}
}
if(temp==4)
{
if(totalpercent+5<=100)
{
totalpercent+=5;
double temp1=(salary*5/100);
totalpaid+=temp1;
income[count]=temp1;
}
else
{
cout<<"----Athlete cant afford---"<<endl;
continue;
}
}
count++;
}
cout<<"*********************"<<endl;
cout<<"Name "<<"salary"<<endl;
for(int i=0;i<count;i++)
{
cout<<strname[i]+" "<<income[i]<<endl;;
}
cout<<"*********************"<<endl;
cout<<"The total amount the athlete paid: "<<totalpaid<<endl;
cout<<"*********************"<<endl;
cout<<"The athlete has left with: "<<salary-totalpaid<<endl;
return 0; }
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images