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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

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.

Expert Solution
Step 1

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

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Graphical User Interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education