For this activity you will implement encapsulation and inheritance in a simple but concrete example. A software business needs your help to design an employee class that includes the following...



  1. For this activity you will implement encapsulation and inheritance in a simple but concrete example. A software business needs your help to design an employee class that includes the following attributes:


    • employee ID(empID),

    • employee name(name),

    • employee pay rate(payRate),

    • employee hours(hours),

    • employee extended pay(extendedPay),

    • employee counter(empCounter).






The business currently hires information technology employees in the form of computer programmers as well as accounting employees. You will design a superclass Employee and the two subclasses InfoTech and Accounting. The Employee class will contain several types of attributes. See theUML diagram for the specifications.















Program Specifications:




Employee Class:



  • The following attributes are entered directly by the user: name, payRate, hours.

  • The extendedPay attribute is calculated as: (payRate * hours).

  • The static attribute empCounter will be incremented each time an Employee object is added. During each add process, capture the value of empCounter and store it in the non-static attribute of empID.




InfoTech and Accounting Classes:



  • The InfoTech class will contain the private string variable progLanguage specifying in which programming language the employee is most skilled, and the Accounting class will contain the private Boolean variable glAccess that specifies whether the employee should have access to the general ledger. Both of those attributes will be input by the user.




Other:



  • Create separate classes for: Employee, InfoTech, and Accounting.

  • Include a main() method to use the classes for this assignment.

  • Each class will contain appropriate constructors, set, and get methods.

  • The superclass Employee will contain a toString method that outputs a message indicating a general employee has been established (hard-coded as text) and will indicate the employee ID, name, pay rate, hours, and extended pay.

  • Each subclass will contain a toString method that outputs the employee type (hard-coded as text) and the value of each attribute from the superclass and from the class.




Program Execution:



  • First, using a main() method, create an Employee object to create a general employee and call its toString() method.

  • Next, create at least two InfoTech and two Accounting objects varying the attributes of each and call the toString() methods for each object calling its class’s toString() method.

  • Finally, create a new reference to an Employee object and individually point it to each of your existing objects one-by-one calling the toString() method polymorphically using the Employee reference.

  • NOTE:The attribute values for each object instance can be passed as hard-coded values.




Also:



  • Include appropriate packageimportdeclarations as needed.

  • Observe proper commenting/documentation techniques. Include clearly written comments/documentation to explain the purpose of major blocks of code. As needed/appropriate, include additional levels of comments/documentation detail to help you understand your code and logic as well as to help your reader understand the same.

  • Observe proper naming conventions for classes, attributes, methods, etc.

Feb 26, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here