Wednesday, 29 August 2012

Name-Ipsit Bibhudarshi, Roll No.-29719, Assignment Code-CSEL-10x

public class EmpSalary
{
                 public static void main(String[] args)
                       {
                            double basicPay[];
                            double salary[];
                            int hrsWrkd[];
                            int i;
                            basicPay[0]=7.50;
                            basicPay[1]=8.20;
                            basicPay[2]=10.00;
                            basicPay[3]=7.00;
                            hrsWrkd[0]=35;
                            hrsWrkd[1]=47;
                            hrsWrkd[2]=73;
                            hrsWrkd[3]=65;
             for(i=0;i<4;i++)
                 {

                     if(basicPay[i]<8.00)
                            {
                                  System.out.println("ERROR!Basic Pay is less than the minimum wage");

                             }
                     else
                            {
                                  if(hrsWrkd[i]<=40)
                                            {
                                                  salary[i]=basicPay[i]*hrsWrkd[i];
                                            }
                                 else if(hrsWrkd[i]>40 && hrsWrkd[i]<=60)
                                            {
                                                  int overtime=hrsWrkd[i]-40;
                                                  salary[i]=(40*basicPay[i]+(overtime*basicPay[i]*1.5));
                                            }
                                 else if(hrsWrkd[i]>60)
                                            {
                                                  salary[i]=(40*basicPay[i])+(20*basicPay[i]*1.5);
                                            }
                            }
                 }
          for(i=0;i<4;i++)
                  {
                          if(basicPay[i]>8.00)
                                    {
                                             System.out.println("The Salary Of"+i+1+"is"+salary[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...