Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

Assignment

The objective of the lab is to take the UML Class diagram and enhance last week's Employee class by making the following changes:

Create a static variable called numEmployees that holds an int and initialize it to zero. This will allow us to count all the Employee objects created in the main class.

Increment numEmployees in all of the constructors

Add overloaded versions of setDependents and setAnnualSalary that accept strings. This way, we will have two "set" methods for both dependents and annual salary; one that accepts a string, and one that accepts its default data type.

Deliverables

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

Zip the project folder files.

STEP 1: Understand the UML Diagram

Back to Top

The following attribute has been added: - static numEmployees: int = 0

The following behaviors have been added: + static getNumEmployees( ) : int + setDependents(in dep : String) : void + setAnnualSalary(in sal : String) : void

STEP 2: Create the Project

You will want to use the Week 2 project as the starting point for the lab.

STEP 3: Modify the Employee

Using the UML Diagrams from Step 1, code the changes to the Employee class.

Create a static numEmployees variable and initialize it to zero.

Increment numEmployees by 1 in each of the constructors.

Create an overloaded setDependents method and this time make the parameter a string.

Create an overloaded setAnnualSalary method and this time make the parameter a string.

Remember that you will have to convert the string in the above two "set" methods to the data type of the attribute.

Make the getNumEmployees a static method. (This way, you can call it with the class name instead of an object name.)

Be sure you follow proper commenting and programming styles (indentation, line spacing, etc.).

STEP 4: Modify the Main Method

Back to Top

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.). Note that several of the steps below were accomplished in last week's assignment. New steps are in bold.

Create an Employee object using the default constructor.

Prompt for and then set the first name, last name, and gender. Consider using your getInput method from Week 1 to obtain data from the user for this step as well as Step 3.

Prompt for and then set dependents and annual salary using the new overloaded setters.

Using your code from Week 1, display a divider that contains the string "Employee Information".

Display the Employee Information.

Display the number of employees created using getNumEmployees. Remember to access getNumEmployees using the class name, not the Employee object.

Create a second Employee object using the multi-arg constructor, setting each of the attributes with the following values: "Mary", "Noia", 'F', 5, 24000.0

Using your code from Week 1, display a divider that contains the string "Employee Information".

Display the employee information for the second Employee object.

Display the number of employees created using getNumEmployees. Remember to access getNumEmployees using the class name, not the Employee object.

STEP 5: Compile and Test

Back to Top

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 6: Screen Prints

Back to Top

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

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M92026903
  • Price:- $35

Priced at Now at $35, Verified Solution

Have any Question?


Related Questions in Programming Language

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As