Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need Java language! 4.10 LAB: Input Validation This program is a basic payroll program. (1) Modify the program to include a loop that provides input

Need Java language!

image text in transcribedimage text in transcribed

4.10 LAB: Input Validation This program is a basic payroll program. (1) Modify the program to include a loop that provides input validation on the number of hours worked. Hours worked must be between 10 and 40 hours. (5 pts) Example output if the user enters 45, 8, and 30 for hours worked in that order) and 8.5 for pay rate. Enter hours worked: 45 Hours must be between 10-40. Re-enter hours worked: Hours must be between 10-40. Re-enter hours worked: 30 Enter pay rate: 8.5 Your pay is $255. (2) Modify the program to include a loop that provides input validation on the pay rate. Pay rate must be between $7.25 and $15. (5 pts) Example output if the user enters 30 for hours worked and 18,5, and 8.5 for pay rate in that order). Enter hours worked: 30 Enter pay rate: 18 Pay rate must be between $7.25 - $15. Re-enter pay rate: Pay rate must be between $7.25 - $15. Re-enter pay rate: 8.5 Your pay is $255. LAB ACTIVITY 4.10.1: LAB: Input Validation 0/107 Payroll.java Load default template... import java.util.Scanner; public class Payroll { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int hours; double payRate; double pay; System.out.println("Enter hours worked:"); hours = scnr .nextInt ; System.out.println("Enter pay rate:"); payRate = scnr.nextDouble(); pay = hours * payRate; System.out.println("Your pay is $" + pay); 19}

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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

4. Choose appropriate and powerful language

Answered: 1 week ago

Question

2. Choose an appropriate organizational pattern for your speech

Answered: 1 week ago