Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

solve in netbeans Task #2 Compile and Execute a Program 1. Compile Pay.java using the JDK or a Java IDE as directed by your instructor.

solve in netbeans
image text in transcribed
image text in transcribed
Task #2 Compile and Execute a Program 1. Compile Pay.java using the JDK or a Java IDE as directed by your instructor. 2. You should not receive any error messages. 3. When this program is executed, it will ask the user for input. You should calculate several different cases by hand. Since there is a critical point at which the calculation changes, you should test three different cases: the critical point, a number above the critical point, and a number below the critical point. You want to calculate by hand so that you can check the logic of the program. Fill in the chart below with your test cases and the result you get when calculating by hand. 4. Execute the program using your first set of data. Record your result. You will need to execute the program three times to test all your data. Note: you do not need to compile again. Once the program compiles correctly once, it can be executed many times. You only need to compile again if you make changes to the code. Hours Rate Pay (hand calculated) Pay (program result) LLLLLLLLLL import java.util.Scanner; // Needed for the Scanner class This program calculates the user's gross pay. public class Pay public static void main(String[] args) // Create a Scanner object to read from the keyboard. Scanner keyboard = new Scanner(System.in); // Identifier declarations double hours; // Number of hours worked double rate; // Hourly pay rate double pay; // Gross pay // Display prompts and get input. System.out.print("How many hours did you work? "); hours = keyboard.nextDouble(); System.out.print("How much are you paid per hour? "); rate - keyboard.nextDouble(); // Perform the calculations. if (hours

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

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions

Question

Able to describe variations in rewards practices.

Answered: 1 week ago