I've seen this question answered for C but I don't know how to translate to Java. Write...

70.2K

Verified Solution

Question

Programming

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:

  1. Basic pay rate: from user's choice
  2. 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).
  3. 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    }}

Answer & Explanation Solved by verified expert
4.0 Ratings (535 Votes)
Codeimport javautilScannerpublic class Pay public static void mainString args Constantsfinal int NORMALWORKHOURS 40final double OVERWORKEDTIMES 15final double TAXRATE1 015final double TAXRATE2 020final double TAXRATE3 025 final double TAXBREAK1 300final double TAXBREAK2 450Declare variablesScanner sc    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students