subject

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) 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 <- 40) pay - hours * rate; else pay - (hours - 40) - (1.5 * rate) + 40 - rate; // Display results. System. out. println("You earned $" + pay);

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
What side length would you specify if you were required to create a regular hexagonal plate that was composed of 33 cm(squared) of sheet metal? dimension the side length to 0.1 cm
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
What statement best describes operating systems? it’s possible for modern computers to function without operating systems. most operating systems are free or very inexpensive. operating systems are managed by the computer’s microprocessor (cpu). operating systems manage the computer’s random access memory (ram).
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
The average cost of one year at a private college in 2012-2013 is $43,289. the average grant aid received by a student at a private college in 2012-2013 is $15,680.   what is the average student contribution for one year at a private college in 2012-2013?
Answers: 3
question
Computers and Technology, 22.06.2019 23:30
What are some ways to use a range name in a formula? check all that apply. in the defined names group, click use in formula, and then select the desired name. begin typing the name in the formula, select a name from the autocomplete list, and use the arrow keys and tab key to enter the name in the formula. begin typing the formula, and then click and drag with the mouse to select the cells to include in the formula. right-click one of the cells in the range. click formula options, and use the dialog box to add the name.
Answers: 1
You know the right answer?
Compile and Execute a Program 1. Compile Pay. java using the JDK or a Java IDE as directed by your...
Questions
question
Spanish, 15.10.2020 06:01
Questions on the website: 13722363