Discount Get CIS 247C ALL WEEKS Solution ONLY $83.95 $111.93
CIS 247C Week 1 - C++ Programming [$9.99]
CIS 247C Week 2 - C++ Programming – Object Construction and Dat... [$15.99]
CIS 247C Week 3 - C++ Programming – Overloaded Methods and Stat... [$15.99]
CIS 247C Week 4 - C++ Programming – Composition and Class Inter... [$19.99]
CIS 247C Week 5 - C++ Programming – Composition, Inheritance, a... [$19.99]
CIS 247C Week 6 - C++ Programming – Abstract Class and Polymorp... [$19.99]
CIS 247C Week 7 - C++ Programming - Putting It All Together [$9.99]
Get Selected Weeks Solution with ONLY NOT Add Selected Tutorials To Cart
CIS247 CIS 247 CIS/247 - CIS247C - Week 2 - Lab 2 - iLab 2 - C++ Programming – Object Construction and Data Abstraction – Guaranteed 100% score
    CIS247 CIS 247 CIS/247 - CIS247C - Week 2 - Lab 2 - iLab 2 - C++ Programming – Object Construction and Data Abstraction – Guaranteed 100% score

CIS247 CIS 247 CIS/247 - CIS247C - Week 2 - Lab 2 - iLab 2 - C++ Programming – Object Construction and Data Abstraction – Guaranteed 100% score


Week 2: Object Construction and Data Abstraction – iLab
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:

  1. Capture the Console output window and paste it into a Word document.
  2. Zip the project folder files.
  3. 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.
The following header files need to be included to support input/output, string processing and formatting services -
#include <iostream>
#include <string>
#include <stdlib.h>
#include <iomanip>
In this class Employee, we will need to declare five data members:
- firstName: string
- lastName: string
- gender: char
- dependents: int
- annualSalary: double
In addition, we will need to declare two constructors –
·    Employee()//default constructor
·    Employee(string firstName, string lastName, char gender, int dependents, double salary) //create a parameterized constructor
A series of getters and setters methods for get and set the following data members –
- firstName     
  string getFirstName() { }
  void setFirstName(string name) {  }
- lastName
  string getLastName() { }
  void setLastName(string name) { }      
- gender
  char getGender() { }
  void setGender(char gen) { }      
- dependents  
  int getDependents() { }
  void setDependents(int dep) { }      
- annualSalary
  double getAnnualSalary() { }
  void setAnnualSalary(double salary) { }
A calculatePay() method that calculates the weekly pay:
  double calculatePay() { }
A displayEmployee() method that displays all the employee information -
  void displayEmployee() { }

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.

Based on the given value, we just need to assign all the default values to the data members in the constructor:
Employee()//default constructor
                   firstName = "not given";
                   lastName = "not given";
                   gender = 'U';
                   dependents = 0;
                   annualSalary = 20000;
4.    The multi-arg constructor should initialize all of the attributes using values passed in using its parameter list.
Employee(string firstName, string lastName, char gender, int dependents, double salary)
//use the this pointer to distinguish between the class attributes and the parameters
                   this->firstName = firstName;
                   this->lastName = lastName;
                   this->gender = gender;
                   this->dependents = dependents;
                   this->annualSalary = salary;
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.
The getters simply returns the data member for outside of class access
       string getFirstName()
                   return firstName;
 The setters allows validation and reassigning values to the data member
          void setFirstName(string name)
                   firstName = name;
6.    The calculatePay( ) method of the Employee class should return the value of annual salary divided by 52 (return annualSalary / 52;).
double calculatePay(){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!
When we display the annualSalary and weekly pay, we need to apply appropriate formatting so the dollar amount can be displayed in a neat two digit format.
void displayEmployee()
                   cout<<"Employee Information\n";
                   cout<<"Name: \t\t" <<firstName << " " << lastName << "\n";
                   cout<<"Gender:\t\t" << gender << "\n";
                   cout<<"Dependents: \t" << dependents << "\n";
                   cout<<"Annual Salary:\t" << setprecision(2)<<showpoint<<fixed<<annualSalary << "\n";
                   cout<<"Weekly Salary:\t" << setprecision(2)<<showpoint<<fixed<<calculatePay();

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:
  1. cout<<"Annual Salary:\t" << setprecision(2)<<showpoint<<fixed<<<="" "\n";
  1. Display the Employee information.
  2. Create a second Employee object using the multi-argument constructor, setting each of the attributes with appropriate valid values.
  3. Using your code from last week, display a divider that contains the string "Employee Information".
  4. 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 F

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

The end of the CIS247C Week 1 iLab. Press any key to continue...
STEP 6: Submit Deliverables

Solution for CIS247 Week 2 Lab 2 in C++, Contain C++ project (Using Visual Studio)

It is 100% correct solution

If you have more questions, please contact me via email, i will help you any time

Thank you

Attached Files

Move over [ preview ] file name to preview content in it!

Write a review

Your Name:

Your Review: Note: HTML is not translated!

Rating: Bad           Good

Enter the code in the box below:

2 Tutorials 10%
3 Tutorials 13%
4 Tutorials 16%
5 Tutorials 19%
6 Tutorials 22%
7 Tutorials 25%
8 Tutorials 28%
9 Tutorials 31%
10 Tutorials 34%
add url more