You will create two objects based on the Employee class, along with a class that contains the main method. The attributes, constructors, and methods for this class must satisfy the requirements in Steps 1 through 3. After you create the objects, you will prompt the user for information and then display it.

STEP 1: Understand the UML Class Diagram

Use the following UML diagram to build the class. The first section specifies the attributes. The second section specifies the behaviors, and the first character specifies the access modifier value, where:

• “-” means that the class member is private, and

• “+” means that the class member is public.

STEP 2: Code the Employee Class

1. Create a new project called “CIS247B_Week2Lab_YourName”.

2. Using the provided Class Diagram from Step 1, code the Employee class in the new project (i.e., “Realize the UML Class diagrams”).

3. The default constructor should set the attributes as follows: firstName = “not given”, lastName = “not given”, gender = “U” (for unknown), dependents = 0, and annualSalary = 20,000.

4. The multi-arg constructor should initialize all of the attributes using values passed in using its parameter list.

5. As shown in the Class diagram, each attribute should have a “getter” to retrieve the stored attribute value, and a “setter” that modifies the value.

6. The calculatePay( ) method of the Employee class should return the value of annual salary divided by 52 (return annualSalary / 52;).

7. The displayEmployee() method should display all the attributes of the Employee object in a well-formatted string with logical labels applied to each attribute. Don't forget to call calculatePay from within the displayEmployee method in order to display the Employee's weekly pay as well!

STEP 3: Code the Main Program

In the Main class, create code statements that perform the following operations. Be sure you follow proper commenting and programming styles (header, indentation, line spacing, etc.).

1. Create an Employee object using the default constructor.

2. Prompt for and then set the first name, last name, gender, dependents, and annual salary. (Remember that you have to convert gender, dependents, and annual salary from strings to the appropriate data type.)

3. Using your code from last week, display a divider that contains the string “Employee Information”

4. Format the currency using the following formatting services:

 

5. Display the Employee information.

6. Create a second Employee object using the multi-argument constructor, setting each of the attributes with appropriate valid values.

7. Using your code from last week, display a divider that contains the string “Employee Information”.

8. Display the Employee information for the second Employee object.

Found something interesting ?

• On-time delivery guarantee
• PhD-level professional writers
• Free Plagiarism Report

• 100% money-back guarantee
• Absolute Privacy & Confidentiality
• High Quality custom-written papers

Related Model Questions

Feel free to peruse our college and university model questions. If any our our assignment tasks interests you, click to place your order. Every paper is written by our professional essay writers from scratch to avoid plagiarism. We guarantee highest quality of work besides delivering your paper on time.

Grab your Discount!

25% Coupon Code: SAVE25
get 25% !!