View Single Post
Old 10-23-2003, 05:04 PM   #3 (permalink)
.pakmon.
Guest
 
Posts: n/a
woot, i got it...

thanks man... works great.
just in case anyone needs this or i made a mistake in my math.

Code:
#include <iostream>
#include <string>
using namespace std;

int main()
{
	string name = " ";
	int total = 0;
	int paycode = 0;
	double salary = 0.0;
	double payRate = 0.0;
	double hourlyRate = 0.0;
	double commissionRate = 0.0;
	double fixedRate = 0.0;
	int hoursWorked = 0.0;
	double itemsProduced = 0.0;
	double overtime = 0.0;
	double sales = 0.0;

	
	cout << "Employee Name: ";
	cin >> name;
	cout << "\nSelect an Employee Status/Paycode for this employee:\n \n 1.Manager \n 2.Hourly Worker \n 3.Commisioned Worker \n 4.Piece Worker? \n \n(Enter 1, 2, 3, or 4 where applicable): ";
	cin >> paycode;


	switch (paycode) 
	{
	case 1:	cout << "What is the weekly salary for this employee?: ";
			cin >> salary;
			cout << " " << name << " has made $ " << salary << " this week." << endl;
			break;
	
	case 2:	cout << "Hourly rate for this employee: " << endl;
			cin >> payRate;
			cout << "Hours worked this week: " << endl;
			cin >> hoursWorked;
			if (hoursWorked > 40)
			{
				total = (40*payRate);
				overtime = total + ((hoursWorked % 10) * (payRate + (payRate / 2)));
				cout << " " << name << " has made a total of $ " << overtime << " for the week." << endl;
			}
			else
			{
				total = payRate * hoursWorked;
				cout << " " << name << " has made a total of $ " << total << " for the week." << endl;
			}
			break;
			
	case 3:	cout << "Enter the number of sales: ";
			cin >> sales;
			cout << "Enter your salary: ";
			cin >> salary;

			commissionRate = 250 + (sales / 7.5);
			total = commissionRate + salary;
			cout << " " << name << " has made $ " << total << " this week." << endl;
			break;

	case 4:	cout << "Enter the number of items produced this week: ";
			cin >> itemsProduced;
			cout << "Enter the cost per item: ";
			cin >> payRate;
			total = itemsProduced * payRate;
			cout << " " << name << " has made $ " << total << " for the week." << endl;
			break;

	default:  cout << "Error" << endl;
	} //end of switch
	
	return 0;
}
  Reply With Quote