Thursday, April 18, 2013

C++ program compute hourly pay taking overtime into account





#include <iostream>
#include <iomanip>
using namespace std;

const int   STD_HRS       = 40;
const float OVERTIME_MULT = 1.5;

int main()
{
   cout << fixed << showpoint;
   cout << setprecision(2);
   float hours, rate;
   cout << "Enter hours worked: ";
   cin  >> hours;
   cout << "Enter rate: ";
   cin  >> rate;
   float regular, overtime;
   if ( hours <= STD_HRS )
   {
      regular  = hours * rate;
      overtime = 0.0;
   }
   else
   {
      regular  = STD_HRS * rate;
      overtime = (hours - STD_HRS) * rate * OVERTIME_MULT;
   }
   float pay;
   pay = regular + overtime;
   cout << "Pay: $" << pay << endl;
   return 0;
}

OUTPUT:
Enter hours worked: 40
Enter rate: 8
Pay: $320.00




---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------




---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
------------------------------------------------------------------------

Overtime Pay Calculations Not Working - C And C++ 
Help With Overtime Pay Calculation‎ 
Compute Employee Gross Pay And Net Pay‎ 
Creating C++ Program To Determine The Gross Pay For Several .
Write a program to calculate the store's weekly payroll
How do you calculate an hourly rate into an annual salary
C++ Program for Employee Payroll System 
IT Certification Category (English)640x480

Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


Top Online Courses From ProgrammingKnowledge

Python Course http://bit.ly/2vsuMaS
Java Coursehttp://bit.ly/2GEfQMf
Bash Coursehttp://bit.ly/2DBVF0C
Linux Coursehttp://bit.ly/2IXuil0
C Course http://bit.ly/2GQCiD1
C++ Coursehttp://bit.ly/2V4oEVJ
PHP Coursehttp://bit.ly/2XP71WH
Android Coursehttp://bit.ly/2UHih5H
C# Coursehttp://bit.ly/2Vr7HEl
JavaFx Coursehttp://bit.ly/2XMvZWA
NodeJs Coursehttp://bit.ly/2GPg7gA
Jenkins Course http://bit.ly/2Wd4l4W
Scala Coursehttp://bit.ly/2PysyA4
Bootstrap Coursehttp://bit.ly/2DFQ2yC
MongoDB Coursehttp://bit.ly/2LaCJfP
QT C++ GUI Coursehttp://bit.ly/2vwqHSZ