Question: Can you please help fix Java code Thank you import java.util.Scanner; public class Overtime { public static void main(String[] args) { Scanner scnr = new

Can you please help fix Java code Thank you

import java.util.Scanner;

public class Overtime { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String firstName; System.out.println("Enter your first name:"); firstName = scnr.next(); System.out.print("Enter your last name: "); String lastName = scnr.next(); System.out.print("Enter the number of hours you worked: "); int hours = scnr.nextInt(); System.out.print("Enter your hourly pay rate: "); double payRate = scnr.nextDouble();

double basePay; double overtimePay = 0.0; if (hours > 40) { basePay = 40 * payRate; overtimePay = (hours - 40) * payRate * 1.5; } else { basePay = hours * payRate; } double totalPay = basePay + overtimePay;

System.out.printf(firstName + " " + lastName + ", your pay is $%.1f%n", basePay+overtimePay ); if (hours > 40) { System.out.printf("Overtime accounts for $%.1f of that.%n", overtimePay); } if (hours > 70) { System.out.println("You worked more than 70 hours. Your check may be delayed 3-4 business days pending manager approval."); } } }

Can you please help fix Java code Thank you import java.util.Scanner; public

2:Compare output Output differs. See highlights below. Input Your output ends with Expectedoutput John Doe, your pay is $398.75 ends with overtime accounts for $108.75 of that

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!