Answer to Question #257466 in Java | JSP | JSF for raizen cutie

Question #257466

Write a program that contains variables that holds the hourly rate and number

of hours worked for an employee who has the weekly salary for 250 an hour,

works 40 regular hours, and earns time and one-half (wage * 1.5) for overtime

hours worked. Display the gross pay, withholding tax, which is 15 percent of

the gross pay, and the net pay (gross pay – withholding).


1
Expert's answer
2021-10-27T16:23:26-0400
import java.util.Scanner;


public class HourlyRate {


	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int hourlyRate = 0;
		double grossPay = 0;
		double payWithoutTax = 0;


		System.out.println("Please provide number of hours worked for an employee on this week and press Enter:");
		hourlyRate = scan.nextInt();
		if (hourlyRate <= 40) {
			grossPay = hourlyRate * 250;
		} else if (hourlyRate > 40) {
			grossPay = (((hourlyRate - 40) * 250) * 1.5) + (40 * 250);
		}
		System.out.println("Emploee gross pay is: " + grossPay);
		payWithoutTax = grossPay - (grossPay * 15) / 100;
		System.out.println("Emploee gross pay minus tax fee: " + payWithoutTax);
		scan.close();
	}
}

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