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

The Employee Class Attributes: • Last Name: string • First Name: string • Title:

ID: 3663068 • Letter: T

Question

The Employee Class Attributes: • Last Name: string • First Name: string • Title: string • Hourly Rate: double • Hours Worked: double • Paycheck: double methods: 1. Constructor: This is called to create an instance of a employee and will have a parameter for EACH of the first and last name, title, hourly rate, and hour’s worked 2. “Calculate Paycheck”: This instance method will calculate the paycheck each employee should receive based on the number of hours worked and the hourly pay rate. Any overtime (greater than 40 hours) pays 1.5X the normal pay rate. 3. “Print Employee”: This instance method will print the employee’s information. This is an accessor method that has NO return value

Explanation / Answer

import java.lang.*;
class Employee
{
String LastName;
String FirstName;
String Title;
double HourlyRate;
double HoursWorked;
double payCheck;
Employee(String ln,String fn,String title, double hr, double hw)
{
LastName = ln;
FirstName = fn;
Title = title;
HourlyRate = hr;
HoursWorked = hw;   
}
void display()
{
System.out.print(LastName+" ");
System.out.print(FirstName+" ");
System.out.print(Title+" ");
System.out.print(HourlyRate+" ");
System.out.print(HoursWorked+" ");

System.out.print(calculatePaycheck());
}

double calculatePaycheck()
{
double ot,TpayCheck;
if(HoursWorked > 40)   
{
payCheck = 40*HourlyRate;
ot = (HoursWorked - 40) * (HourlyRate*1.5);

}
else
{
payCheck = HoursWorked * HourlyRate;
ot = 0;
}
TpayCheck = payCheck + ot;
return TpayCheck;
}
public static void main(String args[])
{
Employee e = new Employee("Venkat","P","Manager",10.5,42);
e.display();
}
}

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