Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- double operate (double yearlySalary)
- {
- return yearlySalary/52;
- }
- void salaried()
- {
- double yearlySalary;
- cout << "Please enter your yearly salary." << endl;
- cin >> yearlySalary;
- double weeklySalary = operate(yearlySalary);
- float grossPayOne;
- float grossPayTwo;
- cout << "Your weekly stipend is: $" << weeklySalary << endl;
- if (weeklySalary > 3000)
- {
- double taxRate = 0.075;
- cout << "The tax rate for your weekly paycheck is 0.075%." << endl;
- grossPayOne = weeklySalary * taxRate;
- cout << "Your Take Home Stipend is: $" << grossPayOne << endl;
- }
- else if (weeklySalary < 3000)
- {
- double userTaxRate;
- cout << "Please enter your tax rate." << endl;
- cin >> userTaxRate;
- grossPayTwo = weeklySalary * userTaxRate;
- cout << "Your Take Home Stipend is: $" << grossPayTwo << endl;
- }
- }
- double operatorTwo (double hourlyRate, double numOfHours)
- {
- return hourlyRate * numOfHours;
- }
- double operatorThree (double hourlyRate, double numOfHours)
- {
- return hourlyRate * 40 + 1.5 * hourlyRate * (numOfHours - 40);
- }
- void hourly()
- {
- int taxChoice = 0;
- double hourlyRate;
- double numOfHours;
- double hourWeekSalaryOne = operatorTwo(hourlyRate, numOfHours);
- double hourWeekSalaryTwo = operatorThree(hourlyRate, numOfHours);
- cout << "Please enter your hourly rate & number of hours." << endl;
- cin >> hourlyRate >> numOfHours;
- if (numOfHours < 40)
- {
- float HomePayOne;
- cout << "Your weekly stipend is: $" << hourWeekSalaryOne << endl;
- 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;
- cin >> taxChoice;
- if (taxChoice == 0)
- {
- HomePayOne = hourWeekSalaryOne * 0.075;
- cout << "Your Take Home Stipend is: $" << HomePayOne << endl;
- }
- else if (taxChoice == 1)
- {
- double UserTaxRateOne;
- cout << "Please enter your tax rate." << endl;
- cin >> UserTaxRateOne;
- HomePayOne = hourWeekSalaryOne * UserTaxRateOne;
- cout << "Your Take Home Stipend is: $" << HomePayOne << endl;
- }
- }
- else if (numOfHours > 40)
- {
- double UserTaxRateTwo;
- float HomePayTwo;
- cout << "Your weekly stipend is: $" << hourWeekSalaryTwo << endl;
- 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;
- cin >> taxChoice;
- if (taxChoice == 0)
- {
- HomePayTwo = hourWeekSalaryTwo * 0.075;
- cout << "Your Take Home Stipend is: $" << HomePayTwo << endl;
- }
- else if (taxChoice == 1)
- {
- cout << "Please enter your tax rate." << endl;
- cin >> UserTaxRateTwo;
- HomePayTwo = hourWeekSalaryTwo * UserTaxRateTwo;
- cout << "Your Take Home Stipend is: $" << HomePayTwo << endl;
- }
- }
- }
- double operatorFour (double a, double b){
- return (a * b);
- }
- void contracted()
- {
- double contractAmount;
- cout << "Please enter amount stated in your contract." << endl;
- cin >> contractAmount;
- double numOfWeeks = 52;
- double contractSalary = operatorFour(contractAmount, numOfWeeks);
- cout << "Your weekly stipend is: $" << contractSalary << endl;
- if (contractSalary > 3000)
- {
- double TaxRate = 0.075;
- float TakeHomePayOne;
- TakeHomePayOne = contractSalary * TaxRate;
- cout << "Your Take Home Stipend is: $" << TakeHomePayOne << endl;
- }
- else if (contractSalary < 3000)
- {
- double InputTaxRate;
- float TakeHomePayTwo;
- cout << "Please enter your tax rate." << endl;
- cin >> InputTaxRate;
- TakeHomePayTwo = contractSalary * InputTaxRate;
- cout << "Your Take Home Stipend is: $" << TakeHomePayTwo << endl;
- }
- }
- int main()
- {
- cout << fixed << setprecision(2);
- char employee = 'S' && 'H' && 'C';
- do{
- char employee = 'S' && 'H' && 'C';
- 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;
- cout << "Whirlpool Inc. Employees are categorized into the following categories: Salaried, Hourly, and Contracted." << endl;
- cout << "Please enter what type of employee you are. (Use S, H, or C)[Enter 0 to quit.]" << endl;
- cin >> employee;
- if(employee == '0')
- {
- return 0;
- }
- if(employee != 'S' && employee != 'H' && employee != 'C') cout << "Invalid input, please try again." << endl;
- }while(employee == 'S' || employee == 'H' || employee == 'C');
- if (employee == 'S')
- {
- salaried();
- }
- if (employee == 'H')
- {
- hourly();
- }
- if (employee == 'C')
- {
- contracted();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement