import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
  Scanner input=new Scanner(System.in);
  System.out.println("Enter the number of employees:");
  int N=input.nextInt();
  int m,y;
  double salary;
  int i=1;
  if(N>1){
  while(i<N){
    System.out.println("Hours worked "+(i)+":");
    m=input.nextInt();
    if(m<=160){
      y=240;
      salary=240*m;
      System.out.println("Salary "+(i)+" is: "+salary);
    }
    else if(m>160){
      y=320;
      salary=320*m;
      System.out.println("Salary "+(i)+" is: "+salary);
    }
    System.out.print("\nHours worked "+(i+1)+":");
    m=input.nextInt();
    i++;
    i++;
   Â
    if(m<=160){
      y=240;
      salary=240*m;
      System.out.println("Salary "+" is: "+salary);
    }
    else if(m>160){
      y=320;
      salary=320*m;
      System.out.println("Salary "+" is: "+salary);
    }
    Â
   Â
  }
  Â
    Â
  }
  else if(N==0){
    System.out.print("No employees provided to do calculations");
  }
else if(N<0){
  System.out.println("Number of employees cannot be negative");
}
}}
Comments
Leave a comment