Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- double operatorOne (double a, double b)
- {
- return (a / b);
- }
- double operatorTwo (double a, double b)
- {
- return (a * b);
- }
- double operatorThree (double a, double b)
- {
- return (a * 40 + 1.5 * a * (b - 40));
- }
- double TaxOperator (double a, double b)
- {
- return a - (a * b);
- }
- int main()
- {
- cout << fixed << setprecision(2);
- char employee = ' ';
- const double standardTax = 0.075;
- const double numOfWeeks = 52;
- do{
- cout << "Welcome to Whirlpool Industries Employee Stipend Calculation System." << endl; // Start of program, welcomes user.
- cout << "This program will produce a calculation of your weekly net pay." << endl; //Explains what program will do.
- cout << "Whirlpool Inc. Employees are categorized into the following categories: Salaried, Hourly, and Contracted." << endl; //Explains how employees are categorized.
- cout << "Please enter what type of employee you are. (Use S, H, or C)[Enter 0 to quit.]" << endl; //Prompts user to pick a category or to quit.
- cin >> employee;
- if(employee == '0')
- {
- return 0;
- }
- if(employee != 'S' && employee != 'H' && employee != 'C') cout << "Invalid input, please try again." << endl; //Shows that user input incorrect information
- if (employee == 'S')
- {
- double yearlySalary;
- cout << "Please enter your yearly salary." << endl;
- cin >> yearlySalary;
- double weeklySalary = operatorOne(yearlySalary, numOfWeeks);
- float grossPayOne;
- float grossPayTwo;
- cout << "Your weekly stipend is: $" << weeklySalary << endl; // Gives weekly stipend
- if (weeklySalary > 3000)
- {
- cout << "The tax rate for your weekly paycheck is 0.075%." << endl;
- grossPayOne = TaxOperator(weeklySalary, standardTax);
- cout << "Your Take Home Stipend is: $" << grossPayOne << endl; // Take Home Stipend
- }
- else if (weeklySalary < 3000)
- {
- double userTaxRate;
- cout << "Please enter your tax rate." << endl;
- cin >> userTaxRate;
- grossPayTwo = TaxOperator(weeklySalary, userTaxRate);
- cout << "Your Take Home Stipend is: $" << grossPayTwo << endl; // Take Home Stipend
- }
- }
- if (employee == 'H')
- {
- int taxChoice = 0;
- double hourlyRate;
- double numOfHours;
- cout << "Please enter your hourly rate." << endl; //Prompts user to input their pay rate
- cin >> hourlyRate;
- cout << "Please enter your number of hours." << endl; //Prompts user to input amount of hours in a week
- cin >> numOfHours;
- if (numOfHours < 40)
- {
- float HomePayOne;
- double hourWeekSalaryOne = operatorTwo(hourlyRate, numOfHours);
- cout << "Your weekly stipend is: $" << hourWeekSalaryOne << endl; // Gives weekly stipend
- cout << "Would you like to use the standard 0.075% tax rate or your own? (Enter 0 for standard or 1 for your own)" << endl; //Prompts user to choose between standard tax rate or their user-inputted tax rate.
- cin >> taxChoice;
- if (taxChoice == 0)
- {
- HomePayOne = TaxOperator(hourWeekSalaryOne, standardTax);
- cout << "Your Take Home Stipend is: $" << HomePayOne << endl; // Take Home Stipend
- }
- else if (taxChoice == 1)
- {
- double UserTaxRateOne;
- cout << "Please enter your tax rate." << endl;
- cin >> UserTaxRateOne;
- HomePayOne = TaxOperator(hourWeekSalaryOne, UserTaxRateOne);
- cout << "Your Take Home Stipend is: $" << HomePayOne << endl; // Take Home Stipend
- }
- }
- else if (numOfHours > 40)
- {
- double UserTaxRateTwo;
- float HomePayTwo;
- double hourWeekSalaryTwo = operatorThree(hourlyRate, numOfHours);
- cout << "Your weekly stipend is: $" << hourWeekSalaryTwo << endl; // Gives weekly stipend
- cout << "Would you like to use the standard 0.075% tax rate or your own? (Enter 0 for standard or 1 for your own)" << endl; //Prompts user to choose between standard tax rate or their user-inputted tax rate.
- cin >> taxChoice;
- if (taxChoice == 0)
- {
- HomePayTwo = TaxOperator(hourWeekSalaryTwo, standardTax);
- cout << "Your Take Home Stipend is: $" << HomePayTwo << endl; // Take Home Stipend
- }
- else if (taxChoice == 1)
- {
- cout << "Please enter your tax rate." << endl;
- cin >> UserTaxRateTwo;
- HomePayTwo = TaxOperator(hourWeekSalaryTwo, UserTaxRateTwo);
- cout << "Your Take Home Stipend is: $" << HomePayTwo << endl; // Take Home Stipend
- }
- }
- }
- if (employee == 'C')
- {
- double contractAmount;
- cout << "Please enter amount stated in your contract." << endl; //Prompts user to input amount from contract
- cin >> contractAmount;
- double contractSalary = operatorOne(contractAmount, numOfWeeks);
- cout << "Your weekly stipend is: $" << contractSalary << endl; // Gives weekly stipend
- if (contractSalary >= 3000)
- {
- float TakeHomePayOne;
- TakeHomePayOne = TaxOperator(contractSalary, standardTax);
- cout << "Your Take Home Stipend is: $" << TakeHomePayOne << endl; // Take Home Stipend
- }
- else if (contractSalary < 3000)
- {
- double InputTaxRate;
- float TakeHomePayTwo;
- cout << "Please enter your tax rate." << endl;
- cin >> InputTaxRate;
- TakeHomePayTwo = TaxOperator(contractSalary, InputTaxRate);
- cout << "Your Take Home Stipend is: $" << TakeHomePayTwo << endl; // Take Home Stipend
- }
- }
- }while(employee == 'S' || employee == 'H' || employee == 'C');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement