Problem 2: Employee Payment The Stark Industry needs a program to calculate how much to pay their hourly employees. They have the following rules: An employee gets paid (hours worked) × (base pay), for each hour up to 40 hours. For every hour over 40, they get overtime = (base pay) × 1.5. If the number of hours is greater than 60, print an error message. Example: If an employee works for 45 hours, and his base pay is $8 , the he will get= (40 * 8)+ [5* (8 * 1.5)] = $380 Create a new class called StarkIndustry. Write a method that takes the base pay and hours worked as parameters, and prints the total pay or an error. Write a main method that calls this method for each of these employees: Employee No Base pay Hours Worked Employee 1 $7.20 35 Employee 2 $8.20 47 Employee 2 $10.50 73 You will have to submit StarkIndustry.java file
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Problem 2: Employee Payment
The Stark Industry needs a
- An employee gets paid (hours worked) × (base pay), for each hour up to 40 hours.
- For every hour over 40, they get overtime = (base pay) × 1.5.
- If the number of hours is greater than 60, print an error message.
Example: If an employee works for 45 hours, and his base pay is $8 , the he will get= (40 * 8)+ [5* (8 * 1.5)] = $380
Create a new class called StarkIndustry.
Write a method that takes the base pay and hours worked as parameters, and prints the total pay or an error. Write a main method that calls this method for each of these employees:
Employee No |
Base pay |
Hours Worked |
Employee 1 |
$7.20 |
35 |
Employee 2 |
$8.20 |
47 |
Employee 2 |
$10.50 |
73 |
You will have to submit StarkIndustry.java file.
Step by step
Solved in 3 steps with 1 images