Project Name:

Worker’s salary calculator

Description:

A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive
a fixed hourly wage for up to the first 40 hours they work and “time and a half”—1.5 times their hourly
wage—for overtime hours worked), commission workers (who receive $250 plus 5.7 percent of their gross
weekly sales), or pieceworkers (who receive a fixed amount of money per item for each of the items they produce—
each pieceworker in this company works on only one type of item).

Code:

/* Luis Delacruz , project_3*/


#include 
#include  
using namespace std;

int main()
{
	int user_input;
	float weekly_salary;
	float hourly_worker_salary;
	float hourly_worker_totalhours;
	float hourly_worker_pay = 0;
	float commision_gross_sales;
	float commision_worker_pay = 0;
	float Piece_worker_wagepp;
	float piece_worker_nump;
	float piece_worker_pay = 0;

	cout << fixed << setprecision(2);
	do
	{
		cout << "Enter paycode (-1 to end): "; 		cin >> user_input;
		switch (user_input){
		case 1:
			cout << "Manager Selected\nEnter weekly salary: "; 			cin >> weekly_salary;
			cout << "Manager weekly salary is: $"<< weekly_salary <> hourly_worker_salary;
			cout << "Enter total hours worked: "; 			cin >> hourly_worker_totalhours;
			if (hourly_worker_totalhours <= 40){
				hourly_worker_pay = hourly_worker_salary * hourly_worker_totalhours;
			}
			else
			{
			hourly_worker_pay = ((hourly_worker_salary * 0.5) + hourly_worker_salary) * hourly_worker_totalhours;
			};
			cout <<"Hourly worker pay is: $" << hourly_worker_pay <<endl<<endl;
			break;
		case 3:
			cout << "Commision worker selected\nEnter gross weekly sales: "; 			cin >> commision_gross_sales;
			commision_worker_pay = (.057 * commision_gross_sales) + 250;
			cout << "Commision worker pay is: $" << commision_worker_pay <<endl<<endl;
			break;
		case 4:
			cout << "piece worker selected\nEnter number of pieces: "; 			cin >> piece_worker_nump;
			cout << "Enter wage per piece: "; 			cin >> Piece_worker_wagepp;
			piece_worker_pay = piece_worker_nump * Piece_worker_wagepp;
			cout <<"Piece worker pay is: $"<< piece_worker_pay <<endl<<endl; 			break; 		} 	} while (user_input > 0);
	cout << endl << "Thanks for using the FSP";




	
}


 Working Code:

Capture

Leave a Reply