Tuesday, 4 September 2012

Name- Susri Saswati , Roll- 29739 , Assignment Code- CSEL-10x

//Program for calculating Total Salary from given Basic Pay per hour
and Working Hour

class TotalSalary
{
public static void main(String[] args)
{
int hours[]={35,47,73,65};

double basicpay[]={7.50,8.20,10.00,7.00};

double totalsalary[]={0.00,0.00,0.00,0.00};


for(int i=0;i<4;i++)
{
if(basicpay[i]<8.00)
{
System.out.println("ERROR !!!\tBasic Pay must not be less than
minimum wage($8.00 per hour)");
}
else if(hours[i]>40&&hours[i]<=60)
{
int overtime=hours[i]-40;
totalsalary[i]=(basicpay[i]*40)+(overtime*basicpay[i]*1.5);
System.out.println((i+1)+"th Employee's Total Salary :
"+totalsalary[i]+"$");
}
else if(hours[i]>60)
{
totalsalary[i]=(basicpay[i]*40)+(20*basicpay[i]*1.5);
System.out.println((i+1)+"th Employee's Total Salary :
"+totalsalary[i]+"$");
}

}
}
};

No comments:

Post a Comment

C Programming

  Table of Contents ​ About the Author 3 ​ Introduction 4 ​ Introduction to Computers 4 1. What is a Computer? 4 2. History...