Viewing code of RPOVERTIME
// ------ ../cgi-bin/cout/RPOVERTIME.CPP --------------
//--- Programmed By Rajesh -----
/*
Calculating Pay with Overtime (Dem 7-1c)
A bookstore owner wants you to write a program that calculates the gross pay of an employee. The input to the program is the number of hours the employee works in one week and the employee’s hourly pay rate. The program is to calculate the employee’s gross pay, including the possibility of overtime pay. Regular pay is the number of hours the employee worked (up to 40 hours) times the hourly pay rate. The program is to pay overtime if the employer worked more than 40 hours. The overtime pay equals the number of hours the employee worked over 40 hours, multiplied by 1.5 (the overtime pay factor), multiplied by the hourly pay rate. The program should out put the worker’s regular pay, overtime pay, and gross pay (the sum of regular and overtime pay).
A sample of the output is:
Enter the number of hours worked: 53
Enter the pay rate: 6.50
Regular Pay Overtime Pay Gross Pay
260.00 126.75 386.75
--------------------------------------------------------
*/
#include<stdio.h>
#include<conio.h>
void main(){
int hours; /* number of hours he worked */
float ot_factor = 1.5; /* Overtime pay factor */
float pay_rate;
int ot;
float regular_pay;
float ot_pay;
float gross_pay;
printf("\n Enter the number of hours worked:");
scanf("%d",&hours);
printf("Enter the pay rate:");
scanf("%f",&pay_rate);
if(hours>40){
ot = hours -40; /* default is 40 */
/* printf("Ot is %d",ot); */
}
else {
ot = 0; /* if he has not worked overtime , overtime is 40 */
}
hours = hours - ot;
regular_pay = pay_rate * hours;
printf("\n Regular Pay = $ %.2f",regular_pay);
ot_pay = ot*ot_factor*pay_rate;
printf("\n Overtime Pay = $ %.2f",ot_pay);
gross_pay = regular_pay + ot_pay;
printf("\nGross pay : $ %.2f",gross_pay);
}
Home
Library Home:
- 1 1111
- 2 AVG_LINE
- 3 Assembly cubing
- 4 EX02_102
- 5 EX02_18
- 6 EX03_10A
- 7 EX03_11A
- 8 EX03_12A
- 9 EX03_9A
- 10 EX18A_R
- 11 EX1_8AR
- 12 EX2_102B
- 13 EX2_102C
- 14 EX2_Q4
- 15 EX3R9A
- 16 EX3_8A
- 17 EXCEQNO4
- 18 EXCSQ6A
- 19 EX_2_102
- 20 EX_CPLUS
- 21 FIB1
- 22 FIB2
- 23 FIB3
- 24 FIBONAC
- 25 FIB_NO_R
- 26 Fibonaci_without ercursion
- 27 MULTIRAJ
- 28 PALINDCT
- 29 PLDRM_N
- 30 Pointer matrix multiply
- 31 RAJ3
- 32 RAJAGE
- 33 RAJMAT1
- 34 RPBROKER
- 35 RPDIGIT
- 36 RPDIGIT1
- 37 RPKILOMETE
- 38 RPOVERTIME
- 39 RPRestaurantBilling
- 40 SRCOMP1
- 41 SRIIMP
- 42 STRUCTCW
- 43 socket programming