Question

In: Computer Science

We now begin learningconcept in modern programming - Object Orientation Programming (OOP). Let's write our first...

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)

Solutions

Expert Solution


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


Related Solutions

I want to remind everyone that our first DQ is due Saturday night. Let's begin by...
I want to remind everyone that our first DQ is due Saturday night. Let's begin by showing your understanding of supply and demand. Create a supply and demand graph in Excel that demonstrates the relationship between the amount buyers are willing to purchase and the quantity available (see page 100 for an example). You may create your own data points (less than 10 data points). Please attach your graphs. Your supply and demand graph should be labeled with: price, quantity,...
What is different between procedural and object-oriented programming? Match each of the following OOP concepts with...
What is different between procedural and object-oriented programming? Match each of the following OOP concepts with its example/description. Question 2 options: 12345678 Providing a way for an entity to behave in several ways OR providing multiple entities to be treated in a similar way 12345678 A key way of saving having to retype a lot of code for similar but different objects 12345678 The removal of non-essential information 12345678 Allowing which function to be called by an object to be...
(a) Explain at least TWO (2) major aspects of an object-oriented programming (OOP). Provide suitable examples,
(a) Explain at least TWO (2) major aspects of an object-oriented programming (OOP). Provide suitable examples,
C++In Object Oriented Programming, classes represent abstractionsof real things in our programs. We must...
C++In Object Oriented Programming, classes represent abstractions of real things in our programs. We must quickly learn how to define classes and develop skills in identifying appropriate properties and behaviors for our class. To this end, pick an item that you work with daily and turn it into a class definition. The class must have at least three properties/data fields and three functions/behaviors (constructors and get/set functions don’t count). Do not pick examples from the textbook and do not redefine...
In Object Oriented Programming, classes represent abstractionsof real things in our programs. We must quickly...
In Object Oriented Programming, classes represent abstractions of real things in our programs. We must quickly learn how to define classes and develop skills in identifying appropriate properties and behaviors for our class. To this end, pick an item that you work with daily and turn it into a class definition. The class must have at least three properties/data fields and three functions/behaviors (constructors and get/set functions don’t count). Do not pick examples from the textbook and do not redefine...
Develop an object-oriented programming (OOP) application to create two clocks simultaneously displaying 12:00 and 24:00 format...
Develop an object-oriented programming (OOP) application to create two clocks simultaneously displaying 12:00 and 24:00 format and allow for user input using secure and efficient C++ code. Thank you!
This week as we continue our discussion on health promotion we will begin to look at...
This week as we continue our discussion on health promotion we will begin to look at health literacy. Health literacy affects everyone we treat. When thinking of health literacy and your current practice or experiences based on the readings and content this week answer the following prompts: Describe an issue where health literacy posed a problem in your practice or experiences-describe this in paragraph format. Provide and describe two evidence-based strategies that can be used to improve a patient's understanding...
Write a program in Java Using object Orientation Design to determine the status of Mini Van...
Write a program in Java Using object Orientation Design to determine the status of Mini Van Doors. A logical circuit receives a different binary code to allow opening different doors. The doors can be opened by a dashboard switch, inside or outside handle. The inside handle will not open the door if the child safety lock is on or the master lock is on. The gear shift must be in the park to open the door. A method must be...
Write a program in Java Using object Orientation Design to determine the status of Mini Van...
Write a program in Java Using object Orientation Design to determine the status of Mini Van Sliding Doors. A logical circuit receives a different binary code to allow opening different doors. The doors can be opened by a dashboard switch, inside or outside handle. The inside handle will not open the door if the child safety lock is on or the master lock is on. The gear shift must be in the park to open the door. A method must...
Write a program in Java Using object Orientation Design to determine the status of Mini Van...
Write a program in Java Using object Orientation Design to determine the status of Mini Van Sliding Doors. A logical circuit receives a different binary code to allow opening different doors. The doors can be opened by a dashboard switch, inside or outside handle. The inside handle will not open the door if the child safety lock is on or the master lock is on. The gear shift must be in the park to open the door. A method must...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT