Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java-BlueJ Conditionals Create a class named PayrollCal and do the following: Cr

ID: 3771826 • Letter: J

Question

Java-BlueJ

Conditionals Create a class named PayrollCal and do the following:

Create a method to calculate an employee’s pay. The method will receive three parameters when executed. The parameters will carry the number of hours, hourly wage and employee status, values M or S, to the method. When the employee’s hours are less than 40, pay is calculated as hoursWorked multiplied by hourlyRate. When the employee works more than 40 hours the regular pay is calculated as above but the hours over 40 earn 1.5 times the regular pay rate. Only salaried employees (empType = S) may earn overtime however. (5 points). Upon running the method the user will get the payroll amount returned.

Explanation / Answer

<code>


/**
* Write a description of class PayrollCal here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class PayrollCal
{

/*
*/
public static float CalculatePay(float hoursworked,float hourlywage,char empType)
{
float sum = 0;
if (hoursworked < 40){
sum= hoursworked * hourlywage;
}else if (hoursworked >= 40){
sum = (40* hourlywage);
}
if (empType == 'S' && hoursworked > 40){
sum += (hoursworked-40)*1.5*hourlywage;
}
return sum;
}
/* function for testing */
public static void main(String args[]){
float x = CalculatePay(23,12,'S');
System.out.println(x);
}
}

</code>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote