Week 2 ilab word doc - #include <iostream>#include <string>#include <iomanip> using namespace std class Employee cfw private string firstName string

Week 2 ilab word doc - #include <iostream>#include...

This preview shows page 1 - 2 out of 2 pages.

#include <iostream> #include <string> #include <iomanip> using namespace std; class Employee { private : string firstName; string lastName; char gender; int dependents; double annualSalary; double weeklyPay; public : string GetInput( string message); void DisplayEmployee(); int input; double data; void CalculatePay(); void setFirstName( string first ) // proper way to use setter { firstName = first ; } string Employee ::getFirstName() // proper way to use getter { return firstName; } void setLastName( string last ) { lastName = last ; } string Employee ::getLastName() { return lastName; } void setDependents( string dep ) // setting dependents as string input then converting to int with input variable which is declared above { input = atoi( dep .c_str()); // then setting dependents = input dependents = input; } int Employee ::getDependents() // returning the converted int value for dependents { return dependents; // dependents is declared in private with an int value } void setAnnualSalary( string pay ) // setting annual salary { data = atof( pay .c_str()); annualSalary = data; } double Employee ::getAnnualSalary()
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read both pages?

  • Fall '12
  • Dearman
  • ASCII, endl, Personal name, Family name, Given name

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes