I've seen this question answered for C but I don't know how totranslate to Java.
Write a program that requests the hours worked in a week and thebasic pay rate, and then prints the gross pay (before tax), thetaxes, and the net pay (after tax).
Assume the following:
- Basic pay rate: from user's choice
- Overtime (in excess of 40 hours) = time and a half (i.e., ifthe hours worked is 45, the hours for pay will be 47.5, which is 40+ 5 * 1.5).
- Tax rate:
- 15% of the first $300;
- 20% of the next $150;
- 25% of the rest.
_____________________________import java.util.Scanner;public class Pay { public static void main(String[] args) { //Constants final int NORMAL_WORK_HOURS = 40; final double OVERWORKED_TIMES = 1.5; final double TAX_RATE_1 = 0.15; final double TAX_RATE_2 = 0.20; final double TAX_RATE_3 = 0.25; final double TAX_BREAK_1 = 300; final double TAX_BREAK_2 = 450; //Declare variables Scanner sc = new Scanner(System.in); int userChoice = 0; double payRate = 0; double hoursWorked = 0;//The actual hours worked double hoursPay = 0; //The times for pay, i.e., one and a half for each hour overworked double grossPay = 0; double netPay = 0; double tax = 0; //Display the choices of basic tax rate //Accept user's choice of pay rate and set up the basic pay rate //Ask user for the hours worked //Calculate the hours for pay: //If the hours worked is less than or equals to 40, same as is //if it's greater than 40, hoursPay = 40 + (hoursWorked - 40) * 1.5 //Calculate the gross pay //Calculate the tax //Calculate the net pay //Display the result }}