Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java programming through eclipse. This is an intro to computer class. Create a c

ID: 3587680 • Letter: J

Question

Java programming through eclipse. This is an intro to computer class. Create a code meeting the following criteria. There is a sample code used for reference.

Sample run:

Enter first and last name:

Fred Flintstone

Enter hours worked:

40.25

Enter hourly pay rate: $

36.00

Employee name: Flintstone, Fred

Hours worked: 40.25

Hourly Rate: $36.00

Gross Pay: $1453.50

Regular Pay: $1440.00

Overtime Pay: $13.50

Deductions:

Federal Tax: $290.70

Total deductions: $290.70

Net Pay: $1162.80

Ue the following criteria to create the code:

Input first and last name

Output the names last, firstin your output

Make the federal withholding rate a constant 20% (not an input value)

No state tax

Generate two new values: regular pay and overtime pay

40 hours workedor less

Regular pay is pay rate * hours worked

Overtime pay is 0

Otherwise

Regular pay is pay rate * 40

Overtime is pay rate * (hours –40)* 1.5

Gross pay is then regular pay + overtime pay

Output should be similarto the instructions in the bookexcept:

regular and overtime pay includedostate tax not included

all currency should be rounded to 2 decimals

Explanation / Answer

import java.io.*;
class Salary{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter first and last name:");
String name=sc.nextLine();
String[] name_split=name.split(' ');
System.out.println("Enter hours worked:");
Float hours_wrk=sc.nextFloat();
System.out.println("Enter hourly pay rate: $");
Float hour_rate=sc.nextFloat();

System.out.println("Employee name: "+name_split[1]+","+name_split[0]);
System.out.println("Hours worked: "+hours_wrk);
System.out.println("Hourly Rate: $"+hour_rate);

Float fed_tax=0.20*gross;
Float reg_pay,overtime_pay;
Float gross=reg_pay+overtime_pay;

if(hours_wrk<40.0)
{
  reg_pay=hour_rate*hours_wrk;
  overtime-pay=0.0;
}
else
{
  reg_pay=hour_rate*40.0;
  overtime_pay=hour_rate*(hours_wrk-40.0)*1.5;
}


System.out.println("Gross Pay: $"+gross);
System.out.println("Regular Pay: $"+reg_pay);
System.out.println("Overtime Pay: $"+overtime_pay);
System.out.println("Deductions:");
System.out.println("Federal Tax: $"+fed_tax);
System.out.println("Total deductions: $"+fed_tax);
System.out.println("Net Pay: $"+(gross-fed_tax));

}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote