Saturday, July 16, 2016

A program to calculate overtime pay of 10 employees. Overtime is paid at the rate of Rs. 12.00 per hour for every hour worked above 40 hours.

Write a program to calculate overtime pay of 10 employees. Overtime is paid at the rate of Rs. 12.00 per hour for every hour worked above 40 hours. Assume that employees do notwork for fractional part of an hour
Let Us C page Page 128 [B] (a)

/*Write a program to calculate overtime pay of 10 employees. Overtime is paid at the rate of Rs. 12.00 per hour for every hour worked above 40 hours. Assume that employees do not work for fractional part of an hour*/ 

#include<stdio.h>

/*Write a program to calculate overtime pay of 10 employees.
Overtime is paid at the rate of Rs. 12.00 per hour for every
hour worked above 40 hours. Assume that employees do not
work for fractional part of an hour


Author : Viks Von Doom 
Date 16/07/2016 Time 1:30 PM IST*/

int main()
{
    int ovr_rate = 12;
    int std_hr = 40;
    int hr_worked;
    int ovr_hr;
    int count = 1;
    int pay;

    while (count <= 10)
    {
        printf("\n Enter the Hours worked : ");
        scanf("%d", &hr_worked);
        ovr_hr = hr_worked - std_hr;
        if (ovr_hr > 0)
        {
            pay = ovr_hr*ovr_rate;
            printf("The Over Time Pay is: %d",pay);
        }
        else printf("Not eligible for overtime pay");

        count = count + 1;
    }


return 0;
}


The output is perfectly the way I wanted it to be. If the employee has worked for less than or equal to 40 hours, the program displays a message that he is not eligible for the overtime pay. for any hour of work over 40 hours, the program displays the payment eligible.


No comments:

Post a Comment