Given the following code: double hourlyPay = 0.0; Scanner scan = new Scanner (Sy
ID: 3826042 • Letter: G
Question
Given the following code: double hourlyPay = 0.0; Scanner scan = new Scanner (System.in); System.out.println("Enter hourly pay rate."); hourly Pay =.scan.nextDouble (); Write this statement {System.out.println("Hourly pay rate must be between 4.50 and 21.50."); System.out.println("Enter a valid hourly pay rate.") hourlyPay = scan.nextDouble (); {//End While Assume that valid hourly pay must be in the range of 4.50 through 21.50, inclusive. Type the exact text for the line of Java that should replace Write this statement shown above.Explanation / Answer
Write this statement will be a while loop
which will keep iterating until the hourlyPay value
is not in range 4.50 and 21.50 inclusive
Answer:
while( hourlyPay < 4.50 || hourlyPay > 21.50)
Which mean iterate the loop if hourlyPay is less than 4.5 or greater than 21.50 (outisde range)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.