Question

In: Computer Science

Write a Java application that inputs an unknown number of employees and determines and displays the...

Write a Java application that inputs an unknown number of employees and determines and displays the gross pay for each employ. The company pays straight time for the first 40 hours worked by each employee (hours times rate), and straight time plus time-and-a-half for all hours worked in excess of 40 hours. Input the number of hours worked and hourly rate for each of the employees, then determine and display the employee’s gross pay. At the end of the program, print the total gross pay for all employees. Make sure you use the sentinel control Algorithm

Solutions

Expert Solution


import java.util.Scanner;

public class EmployeeSalaries {
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int ch = 1;
       int hours;
       double wage, rate, total = 0;
       while (true) {
           System.out.println("Enter number of worked hours (-1 to quit): ");
           hours = sc.nextInt();
           if (hours == -1)
               break;
           System.out.println("Enter hourly rate: ");
           rate = sc.nextDouble();
           if (hours <= 40) {
               wage = hours * rate;
           } else {
               wage = 40 * rate;
               wage = wage + (hours - 40) * rate * 1.5;
           }
           total += wage;
           System.out.println("Wage is : $" + wage);
       }
       System.out.println("Total salaries: $" + total);
   }
}

Note : Please comment below if you have concerns. I am here to help you

If you like my answer please rate and help me it is very Imp for me


Related Solutions

1.Write a Java program that inputs a binary number and displays the same number in decimal....
1.Write a Java program that inputs a binary number and displays the same number in decimal. 2.Write Java program that inputs a decimal number and displays the same number in binary.
JAVA 1. Write an application that inputs a telephone number as a string in the form...
JAVA 1. Write an application that inputs a telephone number as a string in the form (555) 555-5555. The application should use String method split to extract the area code as a token, the first three digits of the phone number as a token and the last four digits of the phone number as a token. The seven digits of the phone number should be concatenated into one string. Both the area code and the phone number should be printed....
Java Write a JavaFX application that displays a button and a number. Every time the button...
Java Write a JavaFX application that displays a button and a number. Every time the button is pushed, change the number to a random value between 1 and 100. Thank you and can you show a picture of the result as well
Tokenizing Telephone Numbers Write java application that inputs a telephone number as a string in the...
Tokenizing Telephone Numbers Write java application that inputs a telephone number as a string in the form (555) 555-5555. The application should use String method split to extract the area code as a token, the first three digits of the phone number as a token and the last four digits of the phone number as a token. The seven digits of the phone number should be concatenated into one string. Both the area code and the phone number should be...
Develop a Java application that determines the gross pay for each of three employees.
(Salary Calculator) Develop a Java application that determines the gross pay for each of three employees. The company pays straight time for the first 40 hours worked by each employee and time and a half for all hours worked in excess of 40. You’re given a list of the employees, their number of hours worked last week and their hourly rates. Your program should input this information for each employee, then determine and display the employee’s gross pay. Use class...
Using Python. Write a program that reads a sequence (unknown number of inputs) of integer inputs...
Using Python. Write a program that reads a sequence (unknown number of inputs) of integer inputs and prints the number of even and odd inputs in the sequence. please explain. Thanks
(JAVA) Write an application that reads three nonzero values entered by the user and determines and...
(JAVA) Write an application that reads three nonzero values entered by the user and determines and prints whether they could represent the sides of a triangle. Enter three sizes, separated by spaces(decimals values are acceptable): 4.5·5.5·3.5 A triangle could measure 4.50, 5.50, by 3.50.
How to write a java application that reads an integer, then determines and display whether it's...
How to write a java application that reads an integer, then determines and display whether it's odd or even. Use the remainder operator.
write an application that inputs a telephone number as a stringin the form (555) 555_5555....
write an application that inputs a telephone number as a string in the form (555) 555_5555. the application should use string method split to extract the area code as a token. the first three digits of the phone number as a token and the last four digits of the phone number as a token. the seven digits of the phone number should be concatenated into one string. Both the area code and the phone number should be printed. Remember that...
This is a Java program Problem Description Write an application that inputs five digits from the...
This is a Java program Problem Description Write an application that inputs five digits from the user, assembles the individual digits into a five-digit integer number (the first digit is for one’s place, the second digit is for the ten’s place, etc.) using arithmetic calculations and prints the number. Assume that the user enters enough digits. Sample Output Enter five digits: 1 2 3 4 5 The number is 54321 Problem-Solving Tips The input digits are integer, so you will...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT