Virtualdouble calcpay0 pure virtual function cis 247c

Info icon This preview shows pages 4–7. Sign up to view the full content.

View Full Document Right Arrow Icon
virtualdouble calcPay()=0; // pure virtual function };
Image of page 4

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CIS-247C Homework H4 solutions 3/27/2012 //-------------------------------------------------------------- ---- // The "Employee" class //-------------------------------------------------------------- ---- class Employee : public iEmployee { private : string firstName; string lastName; char gender; int kids; double salary; staticint employees; // static member of the class Benefit benefits; // "Benefit" object as a data member public : Employee() // default constructor { firstName= "" ; lastName= "" ; gender= 'N' ; kids=0; salary=0.0; employees +=1; // increating the counter value benefits.setBenefit( "No Benefit" , 0.0, 0); } Employee(string f, string l, char g, int k, double s, string h, double li, int v) { firstName=f; lastName=l; gender=g; kids=k; salary=s; employees++; benefits.setBenefit(h, li, v); } //create the accessors and mutators for the benefit object void setFirstName(string f) { firstName=f; } void setLastName(string l) { lastName=l; } void setGender( char g) { gender=g; } void setKids( int k) { kids=k; } void setSalary( double s) { salary=s; } void setBenefits(Benefit b) { benefits=b; } string getFirstName() { return firstName; } string getLastName() { return lastName; } char getGender() { return gender; } int getKids() { return kids; } double getSalary() { return salary; } Benefit getBenefits() { return benefits; } void getEmployee() { cout<< "Employee Information\n" ;
Image of page 5
CIS-247C Homework H4 solutions 3/27/2012 cout<< "====================================================\n" ; cout<< "Name: \t\t" <<firstName << " " <<lastName << "\n" ; cout<< "Gender:\t\t" <<gender << "\n" ; cout<< "Dependents: \t" <<kids << "\n" ; cout<< "Annual Salary:\t" <<setprecision(2)<<showpoint<<fixed<<salary << "\n" ; cout<< "Weekly Salary:\t" <<setprecision(2)<<showpoint<<fixed<<calcPay()<< "\n" ; benefits.getBenefit(); } staticint getEmployees() { return employees; } double calcPay() { return salary/52; } }; int Employee::employees=0; //initialize static data members void DisplayApplicationInformation() { cout<< "Welcome to your Object Oriented Program--Employee Class" << "CIS247C, Week 4 Lab" << "Name: Prof.Nana Liu" ; } void DisplayDivider(string message) {cout<< "\n*************** " + message + " *********************\n" ;} string GetInput( string message) { string mystring; cout<< "Please enter your " <<message << " : " ; getline(cin, mystring); return
Image of page 6

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern