In: Computer Science
We now begin learningconcept in modern programming - Object Orientation Programming (OOP). Let's write our first Class definition, and then instantiate an object of this Class to run in a test application to test our objects behaviors.
Employee.java - Make an Employee Class, code to the design of the UML diagram
-name: String -employeeId: int -Shift: Boolean -HourlyPay: double  | 
+Employee() +setName(n: String) +setemployeeId(i:int) +setShift(s:Boolean) +setHourlyPay(p:double) +getname() : String +getemployeeId() : int +getShift() : Boolean +getHourlyPay() : double +calculateOvertimePay( hours : doube) : double +calculateRegPay(hours : double): double +PrintPayStub (hours : double)  | 
public class Employee {
   private String name;
   private int employeeId;
   private boolean Shift;
   private double HourlyPay;
   public Employee() {
   }
   public String getName() {
       return name;
   }
   public int getEmployeeId() {
       return employeeId;
   }
   public boolean isShift() {
       return Shift;
   }
   public double getHourlyPay() {
       return HourlyPay;
   }
   public void setName(String aName) {
       name = aName;
   }
   public void setEmployeeId(int aEmployeeId) {
       employeeId = aEmployeeId;
   }
   public void setShift(boolean aShift) {
       Shift = aShift;
   }
   public void setHourlyPay(double aHourlyPay) {
       HourlyPay = aHourlyPay;
   }
   public double calculateOvertimePay( double hours )
{
       if(hours>40) {
           return
(hours-40) * HourlyPay * 1.5;
       }
       return 0;
   }
   public double calculateRegPay(double hours ){
       if(hours<=40)
           return hours *
HourlyPay;
       return 40 * HourlyPay;
   }
   void PrintPayStub (double hours) {
       System.out.println("Number of
hours: "+hours);
       System.out.println("Regular Pay:
"+calculateRegPay(hours));
       System.out.println("Overtime Pay:
"+calculateOvertimePay(hours));
      
   }
}
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me