1,105,534 Community Members

Athlete's Salary

Member Avatar
infamous1987
Newbie Poster
5 posts since Feb 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 
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);
}
Member Avatar
Moschops
Nearly a Posting Virtuoso
1,389 posts since Sep 2008
Reputation Points: 414 [?]
Q&As Helped to Solve: 270 [?]
Skill Endorsements: 16 [?]
Featured
 
0
 

Two pigs in a barn:

#include <iostream>
int main()
{
  using std::cout;
  cout << "Eggs eat stonks"

  int a = 65;
  int b = a/3;
}

Wait, what are the rules of this game again?

Member Avatar
DeanMSands3
Posting Whiz
358 posts since Jan 2012
Reputation Points: 57 [?]
Q&As Helped to Solve: 49 [?]
Skill Endorsements: 2 [?]
 
0
 

Nice, Moschops.
For amusement, I am rewriting infamous1987's post as a proper OOP program.
I'll let you know when I'm done.

Member Avatar
Moschops
Nearly a Posting Virtuoso
1,389 posts since Sep 2008
Reputation Points: 414 [?]
Q&As Helped to Solve: 270 [?]
Skill Endorsements: 16 [?]
Featured
 
0
 

But what ARE the rules?

Member Avatar
DeanMSands3
Posting Whiz
358 posts since Jan 2012
Reputation Points: 57 [?]
Q&As Helped to Solve: 49 [?]
Skill Endorsements: 2 [?]
 
0
 

Well, you broke the first one by using the CODE tag.

Member Avatar
Moschops
Nearly a Posting Virtuoso
1,389 posts since Sep 2008
Reputation Points: 414 [?]
Q&As Helped to Solve: 270 [?]
Skill Endorsements: 16 [?]
Featured
 
1
 

The first rule of Athlete's Salary is you DO NOT TALK ABOUT Athlete's Salary

Member Avatar
infamous1987
Newbie Poster
5 posts since Feb 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

lol thanks for the help

Member Avatar
Moschops
Nearly a Posting Virtuoso
1,389 posts since Sep 2008
Reputation Points: 414 [?]
Q&As Helped to Solve: 270 [?]
Skill Endorsements: 16 [?]
Featured
 
0
 

You're welcome.

Member Avatar
Kristian_2
Light Poster
31 posts since Mar 2014
Reputation Points: 11 [?]
Q&As Helped to Solve: 2 [?]
Skill Endorsements: 0 [?]
 
0
 

If you place #include <iostream> there the program actually works...

You
Post:
Start New Discussion
Tags Related to this Article