Question: Use jGRASP to complete the following programs and understand what they do. / /*************************************************************************************** / / Wages.java / / Demonstrates the use of an if-else

Use jGRASP to complete the following programs and understand what they do. / /*************************************************************************************** / / Wages.java / / Demonstrates the use of an if-else statement. / / ************************************************************************************** import java.text.NumberFormat; import java.util.Scanner; public class Wages { / / ----------------------------------------------------------------------------------------------------- / / Reads the number of hours worked and calculates wages. / / ----------------------------------------------------------------------------------------------------- public static void main(String[] args) { final double RATE = 8.25; / / regular pay rate final int STANDARD = 40; / / standard hours in a work week double pay = 0.0; int hours; NumberFormat fmt = NumberFormat.getCurrencyInstance(); Scanner scan = new Scanner(System.in); System.out.print("Enter the number of hours worked: "); hours = scan.nextInt(); System.out.println (); / / Pay overtime at "time and a half" if (hours > STANDARD) pay = STANDARD * RATE + (hours - STANDARD) * (RATE * 1.5); else pay = hours * RATE; System.out.println("Gross earnings: " + fmt.format(pay)); } }

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!