Question: 1. Write a public method that takes two arguments: a double representing the number of hours worked and a double representing the hourly pay, and

1. Write a public method that takes two arguments: a double representing the number of hours worked and a double representing the hourly pay, and returns a double representing the weekly pay. If the hours are less than or equal to 40, the weekly pay should be hours times hourly pay. If the hours are greater than 40 and less than 80, the weekly pay should be 40 times the hourly pay, plus the hours in excess of 40 times hourly pay times 1.5. If the hours worked are entered as less than zero or greater than 80, print an error message saying "incorrect number of hours entered" and return 0.0;

2. Write a code fragment that creates a one-dimensional array of doubles called myArray and assigns it the following data:

14.3, 22.3, 20.0, 2.3

3. Write Java statements that will loop through an array called myArray which is {16, 15, 5, 99, 100} and print each element on a separate line. Assume that the appropriate code (e.g., import statements, class header and main method, etc.) is already written to support the statements that print these lines.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!