// 2it218 tester.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
#include <iostream>
#include <string>
#include <iomanip>
#include <conio.h>
using namespace std;
//Global Declarations of Variables
double iovertime_hours=0,iwage=0,iovertime_pay=0,iovertime_extra=0,ihours=0;
string cname ;
int main ()
{
//Enter Employee Information
cout << "\n\nEnter the employee name = ";
cin >> cname ;
cout << "Enter the hours worked = ";
cin >> ihours;
cout << "Enter his or her hourly wage = ";
cin >> iwage;
// Determine if hours are greater than 40
if (ihours <40)
{
//Do Calculations
iovertime_hours=(40-ihours);
iovertime_pay=(ihours-40)*iwage*1.5;
iovertime_extra=iovertime_hours*iwage*1.5;
// Display Employee Details
cout << "Employee Name ............. = " << cname << endl ;
cout << "Base Pay .................. = " << ihours-40*iwage << endl;
cout << "Hours in Overtime ......... = " << iovertime_hours-(40-ihours) << endl ;
cout << "Overtime Pay Amout......... = " << iovertime_pay*iovertime_hours*iwage*1.5 << endl ;
cout << "Total Pay ................. = " << iovertime_extra+(ihours-40)*(iwage)+(iovertime_hours*iovertime_pay) << endl;
}
else // Else hours are less than 40 hours
{
cout << "\n\n";
cout << "Employee Name ............. = " << cname << endl ;
cout << "Base Pay .................. = " << ihours*iwage << endl ;
cout << "Hours in Overtime ......... = " << iovertime_hours-(40-ihours) << endl ;
cout << "Overtime Pay Amout......... = " << iovertime_extra +(ihours-40)*iwage*1.5<< endl ;
cout << "Total Pay ................. = " << iovertime_extra+(iovertime_hours * iwage*1.5)+(ihours*iwage) << endl;
_getch();
} // End of the primary if statement
} //End of Int Main
MOD EDIT: Added code tags. When posting code...USE CODE TAGS!!!
This post has been edited by JackOfAllTrades: 16 November 2012 - 03:37 PM

New Topic/Question
Reply



MultiQuote








|