Answer to Question #297590 in Java | JSP | JSF for rim

Question #297590

Develop a Java application that will determine 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 hours. You are given a list of the employees of the company,

the number of hours each employee worked last week and the hourly rate

of each employee. Your program should input this information for each

employee and should determine and display the employee’s gross pay.


1
Expert's answer
2022-02-14T19:21:28-0500
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (true) {
            System.out.println("Name(empty - Exit):");
            String name = in.nextLine();
            if(name.length()==0){
                break;
            }
            System.out.println("Hours");
            int hours = Integer.parseInt(in.nextLine());
            System.out.println("Rate:");
            double rate = Double.parseDouble(in.nextLine());
            System.out.println(name + " Gross: " + (hours <= 40 ? rate * hours : (rate * 40) + (rate * (hours - 40) * 1.5)));
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS