Sunday 16 August 2015

WAP in java to calculate overtime pay of 10 employees.Overtime is paid at the rate of 12 Rs./hr for every hour worked above 40 hours.Assume that the employees do not work for the fractional part of an hour.

//Calculate overtime

import java.util.Scanner;

public class Overtime {

public static void main(String args[])
{
int e[]=new int[10],o[]=new int[10],i;
Scanner sc=new Scanner(System.in);

System.out.println("Enter overtime hrs for 10 employees:");
for(i=0;i<10;i++)
e[i]=sc.nextInt();

System.out.println("Overtime Pay for 10 employees");
{
for(i=0;i<10;i++)
{
if(e[i]>40)
o[i]=(e[i]-40)*12;
else
o[i]=0;

System.out.println("Employee No:"+(i+1)+" Overtime pay:Rs."+o[i]);
}
}

}

}

No comments:

Post a Comment