Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions

Question

=+ (a) Show that P(U"_[X ,, = j i.o.]) =0 for all i.

Answered: 1 week ago