-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewSeven.cpp
More file actions
45 lines (31 loc) · 1.47 KB
/
Copy pathnewSeven.cpp
File metadata and controls
45 lines (31 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iomanip>
#include <string>
#include <iostream>
#include <cstdlib>
#include "newSeven.h"
using namespace std;
int main()
{
//implement class Employee
//instantiate an object of class Employee
Employee employee(25110, 2350, 2400, 0.08);
//have user enter details of the employee in question
//cin>>employee;
//access the values of the object
double currentBasicSalary = employee.getBasicSalary();
double currentPension = employee.getPension();
double currentMedicalAid = employee.getMedicalAid();
float currentTaxPercentage = employee.getTaxPercentage();
//display the values of the object
cout <<"\n\nThe details of the employee are as follows: ";
cout << "\nBasic Salary: "<<currentBasicSalary;
cout <<"\nPension contributed by employee: "<<currentPension;
cout << "\nMedical aid amount contributed by employee: "<<currentMedicalAid;
cout <<"\nTax percentage applicable to employee: "<<currentTaxPercentage;
double currentGrossPay = employee.calcGrossPay(employee);
double currentDeductions = employee.calcDeductions(employee);
double currentTaxAmount = employee.calcTax(currentGrossPay, currentDeductions, employee);
double netSalary = currentGrossPay - currentTaxAmount - employee.getPension() - employee.getMedicalAid();
cout <<"\nNet salary after medical aid, pension and tax has been paid: "<<fixed<<setprecision(2)<<netSalary;
return 0;
}