Create an employee object using the default constructor

Assignment Help Programming Languages
Reference no: EM131564600

Assignment

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.

Employee

- firstName : string
- lastName : string
- gender - char
- dependents - int
- annualSalary : double

+Employee()
+Employee(in first : string, in last : string, in gen : char, in dep : int, in salary : double)
+calculatePay() : double
+displayEmployee() : void
+getFirstName() : string
+setFirstName(in first : string)
+getLastName() : string
+setLastName(in last : string)
+getGender() : char
+setGender(in gen : char)
+getDependents() : int
+setDependents(in dep : int)
+getAnnualSalary() : double
+setAnnualSalary(in salary : double)

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.

STEP 4: Compile and Test

When done, compile and run your code.

Then, debug any errors until your code is error-free.

Check your output to ensure that you have the desired output, modify your code as necessary, and rebuild.

STEP 5: Screen Prints

Capture the Console output window and paste into a Word document. The following is a sample screen.

522_Screenshot.jpg

STEP 6: Submit Deliverables

• Capture the Console output window and paste into a Word document.

• Upload the zip file and screenshots (Word document that contains programming code and screenshots of program output).

Reference no: EM131564600

Questions Cloud

Discuss the first year production of oil : Oil pumped from a certain oil field decreases 10% each year. How long will it take for production to be 10% of the first year's production?
Capstone learning outcomes : developing a more complete understanding of key theories and concepts associated with the Capstone learning outcomes
Preconditions for economic growth : "List and discuss the three preconditions for economic growth. Do you believe that one of these is the most important and, if so, why?''
Possible means of reducing the wage gap : Prohibition of discrimination, affirmative action, and comparable worth are all possible means of reducing the wage gap.
Create an employee object using the default constructor : Create an Employee object using the default constructor. Format the currency using the following formatting services. Display the Employee information.
Find the first three terms of the binomial expansion : A wire hung between two poles is parabolic in shape. To find the length of wire between two points on the wire, the expression v(1 + 0.08x2) is used.
Developing a new drug : Your firm spent $100 million developing a new drug. It has now been approved for sale, and each pill cost $1 to manufacture.
Elaborate marketing plan proposal : The Marketing Plan Proposal explain the product and market. Please use proper grammar and punctuation.
Calculating hypothetical changes in gdp : Go to the Bureau of Economic Analysis at http://www.bea.gov, and use the BEA interactivity feature to select National Income and Product Account Tables.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd