Question: / / * * * * * * * * * * * * * * * * * * * * * * *
Assignment Object Oriented Design
Name:
Class: C Programming,
Date:
Description: An object oriented program design using
C that will process our existing set of employees.
It utilizes a class called Employee and generates an
array of objects that are used to store, calculate,
and print out a simple report of inputted and calculated
values.
Object Oriented Design using C
#include std::setprecision, std::setw
#include std::cout, std::fixed
#include string functions
define constants
#define EMPSIZE
#define STDHOURS
#define OTRATE
#define MATAXRATE
#define NHTAXRATE
#define VTTAXRATE
#define CATAXRATE
#define DEFAULTTAXRATE
#define NAMESIZE
#define TAXSTATESIZE
#define FEDTAXRATE
#define FIRSTNAMESIZE
#define LASTNAMESIZE
using namespace std;
class Employee
class Employee
private:
private data available only to member functions
string firstName; Employee First Name
string lastName; Employee Last Name
string taxState; Employee Tax State
int clockNumber; Employee Clock Number
float wageRate; Hourly Wage Rate
float hours; Hours worked in a week
float overTimeHrs; Overtime Hours worked
float grossPay; Weekly Gross Pay
float stateTax; State Tax
float fedTax; Fed Tax
float netPay; Net Pay
private member function to calculate Overtime Hours
float calcOverTimeHrs
Calculate the overtime hours for the week
if hours STDHOURS
overTimeHrs hours STDHOURS; ot hours
else
overTimeHrs ; no ot hours
the calculated overtime hours
return overTimeHrs;
calcOverTimeHrs
private member function to calculate Gross Pay
float calcGrossPay
Process gross pay based on if there is overtime
if overTimeHrs
overtime
grossPay STDHOURS wageRate normal pay
overTimeHrs wageRate OTRATE; ot pay
else no overtime pay
grossPay wageRate hours; normal pay
the calculated gross pay
return grossPay;
calcGrossPay
private member function to calculate State Tax
float calcStateTax
float theStateTax; calculated state tax
theStateTax grossPay; initialize to gross pay
calculate state tax based on where employee resides
if taxStatecompareMA
theStateTax MATAXRATE;
else if taxStatecompareVT
theStateTax VTTAXRATE;
else if taxStatecompareNH
theStateTax NHTAXRATE;
else if taxStatecompareCA
theStateTax CATAXRATE;
else
theStateTax DEFAULTTAXRATE; any other state
return the calculated state tax
return theStateTax;
calcStateTax
private member function to calculate Federal Tax
float calcFedTax
float theFedTax; The calculated Federal Tax
Federal Tax is the same for all regardless of state
theFedTax grossPay FEDTAXRATE;
return the calculated federal tax
return theFedTax;
calcFedTax
private member function to calculate Net Pay
float calcNetPay
float theNetPay; total take home pay minus taxes
float theTotalTaxes; total taxes owed
calculate the total taxes owed
theTotalTaxes stateTax fedTax;
calculate the net pay
theNetPay grossPay theTotalTaxes;
return the calculated net pay
return theNetPay;
calcNetPay
public:
p lic member functions that can be called
to access private data member items
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
