Computers and Technology

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);

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:00, Trumpman137
Which option marks all modification made within a document? review comment track changes balloons
Answers: 1
image
Computers and Technology, 22.06.2019 20:00, hannahliebl2000
Need asap write a short paper describing the history and differences between six sigma, waterfall, agile, and scrum models. understanding these models can give you a good idea of how diverse and interesting it development projects can be. describe what the rationale for them is and describe their key features. describe the history behind their development. at least 400 words
Answers: 1
image
Computers and Technology, 24.06.2019 05:30, lexie2751
How do i get rid of my member ship for
Answers: 2
image
Computers and Technology, 24.06.2019 14:00, superstarsara5ouh83x
Fast answer i need for apex ! smartphones should be banned from the classroom in public schools so that students cannot cheat on test so easily? which is an example of a counter argument to the thesis above? a. the classroom is a place for learning not for making phone calls b. smartphones are useful learning tools in the modern classroom c. banning smartphones will not students pay attention to teachers any better d. banning smartphones would decreased incidents of theft
Answers: 2
Do you know the correct answer?
Compile and Execute a Program 1. Compile Pay. java using the JDK or a Java IDE as directed by your...

Questions in other subjects: