Write a java application that will determine the salary for each of several employees. The
company pays “straight-time” for the first 40 hours, if the employee worked more than 40
hours, we consider the extra hours as overtime and the employee gets 50% extra for each
overtime hour. You are given a list of employees of the company, each employee has a number
of worked hours and hourly rate.
Your application should input this information (worked hours and hourly rate) for each
employee then it should determine and display the employee’s salary.
The program will stop if we enter -1.

Respuesta :

The program illustrates the use of repetitive operations.

The program in java is as follows, where comments are used to explain each line

import java.util.*;

public class Main{

   public static void main(String [] args){

//This creates a scanner object

       Scanner input = new Scanner(System.in);

//This declares employee number and hours, as integer

       int empNum, hrs;

//This declares the rate and pay (salary) as double

       double rate,pay;

//This gets input for employee number

       empNum = input.nextInt();

//The following while operation is repeated until user inputs -1

       while(empNum != - 1){

//This gets input for worked hours

           hrs = input.nextInt();

//This gets input for work rate

           rate = input.nextDouble();

//This calculates the pay (base salary)

           pay = rate * hrs;

//If worked hours is more than 40

           if(hrs >40){

//This calculates the additional pay

               pay += 0.5 * pay;

           }

//This prints the total salary

           System.out.println("Salary: "+pay);

//This gets input for the employee number            

           empNum = input.nextInt();

       }

   }

}// The program ends here

At the end of the program, the program prints the employee's salary

See attachment for sample run

Read more about java programs at:

https://brainly.com/question/15831954

Ver imagen MrRoyal