using namespace std;
int numCheck(int x);
int main ()
{
const double LAWYER = 0.10, PERSONAL_ASSISTANT = 0.03, AGENT = 0.07,
TRAINER = 0.05;
double athleteBeginSalary(0.0), lawyerSalary(0.0), personalAssistantSalary(0.0), agentSalary(0.0),
trainerSalary(0.0), professionalTotalSalary(0.0), athleteEndSalary(0.0);
int numLawyer, numPersonalAssistant, numAgent, numTrainer, x(1), y(0);
string firstName[8], lastName[8];
// The number of the Professional hired: Lawyer, Personal Assistant, Agents, and Trainer //
cout << "Enter the number of Lawyers hired: ";
cin >> numLawyer;
while((numLawyer < 0) || (numLawyer > 2))
{
numLawyer = numCheck(numLawyer);
}
if(numLawyer != 0)
{
cout << "Now enter the names of each Lawyer: \n";
for(int i = 0; i < numLawyer; i++, x++)
{
cout << "Lawyer " << x <<": ";
cin >> firstName[i] >> lastName[i];
}
}
cout << "Enter the number of Personal Assistants hired: ";
cin >> numPersonalAssistant;
while((numPersonalAssistant < 0) || (numPersonalAssistant> 2))
{
numPersonalAssistant = numCheck(numPersonalAssistant);
}
if(numPersonalAssistant != 0)
{
cout << "Now enter the names of each Personal Assistant: \n";
for(int i = 2, x = 1; i < (numPersonalAssistant + 2); i++, x++)
{
cout << "Personal Assistant " << x <<": ";
cin >> firstName[i] >> lastName[i];
}
}
cout << "Enter the number of Agents hired: ";
cin >> numAgent;
while((numAgent < 0) || (numAgent> 2))
{
numAgent = numCheck(numAgent);
}
if(numAgent != 0)
{
cout << "Now enter the names of each Agents: \n";
for(int i = 4, x = 1; i < (numAgent + 4); i++, x++)
{
cout << "Agent " << x <<": ";
cin >> firstName[i] >> lastName[i];
}
}
cout << "Enter the number of Trainers hired: ";
cin >> numTrainer;
while((numTrainer < 0) || (numTrainer> 2))
{
numTrainer = numCheck(numTrainer);
}
if(numTrainer != 0)
{
cout << "Now enter the names of each Trainer: \n";
for(int i = 6, x = 1; i < (numTrainer + 6); i++, x++)
{
cout << "Trainer " << x <<": ";
cin >> firstName[i] >> lastName[i];
}
}
for(int i = 0; i < 8; i++)
{
cout << firstName[i] <<" "<<lastName[i]<<"\n";
}
// Enter Salary of the Athlete, Lawyer, Personal Assistant, Agent and Trainer //
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout << "Enter the athlete begininng salary for the year: " << "$";
cin >> athleteBeginSalary;
lawyerSalary = (athleteBeginSalary * 0.10) * (numLawyer);
personalAssistantSalary = (athleteBeginSalary * 0.03) * (numPersonalAssistant);
agentSalary = (athleteBeginSalary * 0.07) * (numAgent);
trainerSalary = (athleteBeginSalary * 0.05) * (numTrainer);
professionalTotalSalary = (lawyerSalary + personalAssistantSalary + agentSalary + trainerSalary);
athleteEndSalary = ( athleteBeginSalary - professionalTotalSalary);
cout <<"\n If no value is displayed under a category, then no value was entered.\n";
cout << endl << endl;
cout << "LAWYER(S) PAY: \n";
for(int i = 0; i < numLawyer; i++)
{
cout << firstName[i] <<" "<< lastName[i] << ": $" << (lawyerSalary/numLawyer)<< endl;
}
cout << endl << endl;
cout << "PERSONAL ASSISTANT(S) PAY: \n";
for (int i = 2; i < numPersonalAssistant + 2; i++)
{
cout << firstName[i] << " " << lastName[i] << ": $" << personalAssistantSalary/numPersonalAssistant << endl;
}
cout << endl << endl;
cout << "AGENT (S) PAY: \n";
for (int i = 4; i < numAgent + 4; i++)
{
cout << firstName[i] << " " << lastName[i] << ": $" << agentSalary/numAgent << endl;
}
cout << endl << endl;
cout << "TRAINER (S) PAY: \n";
for (int i = 6; i < numTrainer + 6; i++)
{
cout << firstName[i] << " " << lastName[i] << ": $" << trainerSalary/numTrainer << endl;
}
cout << endl << endl;
cout << "The total amount paid to the hired professional is " << " $ " << professionalTotalSalary << endl;
cout << endl << endl;
cout << "The Ending salary of the athlete is " << " $ " << athleteEndSalary << endl;
system("pause");
return 0;
}
int numCheck(int x)
{
int y;
if((x < 0)||(x > 2))
{
cout << "Invalid Number! Number Must Be Not Less Than 0"
<< "or Greater Than 2. Please Enter A Valid Number: ";
cin >> y;
}
return(y);
}
infamous1987 0 Newbie Poster
Moschops 683 Practically a Master Poster Featured Poster
DeanMSands3 69 Junior Poster
Moschops 683 Practically a Master Poster Featured Poster
DeanMSands3 69 Junior Poster
Moschops 683 Practically a Master Poster Featured Poster
infamous1987 0 Newbie Poster
Moschops 683 Practically a Master Poster Featured Poster
Kristian_2 11 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.