C1S247 Lab 2 in C++ – Guaranteed 100% score
iLab 2 of 6: Employee Class
i L A B O V E R V I E W
Scenario and Summary
We begin our investigation of object-oriented programming by creating an object-oriented program with a class called Employee. 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.
We will want to ensure that this first class is well-constructed and tested since we will extend this class in Labs 3 through 6.
Due this week:
• Capture the Console output window and paste it into a Word document.
• Zip the project folder files.
• Put the zip file and screen shots (Word document that contains programming code and screen shots of program output) in the Dropbox.
i L A B S T E P S
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:
cout<<"Annual Salary:\t" << setprecision(2)<
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.
Screenshot of a program output that reads: Welcome to your first Object Oriented Program--Employee ClassCIS247C, Week 2 Lab Name: Prof.Nana Liu *************** Employee 1 *************** Please enter your First Name Nana Please enter your Last Name Liu Please enter your Gender Female Please enter your Dependents 2 Please enter your Annual Salary 60000 Employee Information ___________________________________________ Name: Nana Liu Gender: F Dependents: 2 Annual Salary: 60000.00 Weekly Salary 1153.85 *************** Employee 2 *************** Name: Mary Noia Gender: F Dependents: 2 Annual Salary: 150000.00 Weekly Salary: 2884.62 The end of the CIS247C Week 1 iLab. Press any key to continue...
STEP 6: Submit Deliverables
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at email@example.com.
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at firstname.lastname@example.org and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at email@example.com.
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.