Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Worker's S Salary (C++)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

#include <stdafx.

h>
#include <iostream>

using namespace std;

class Employ
{
int no;
char name[40];
char lastname[40];
double salary;
int hour;

public:
void noSet(int var)
{
no = var;
}
void nameSet(char* var)
{
strcpy_s(name, var);
}
void lastnameSet(char* var)
{
strcpy_s(lastname, var);

}
void salarySet(double var)
{
salary = var;
}
void hourSet(int var)
{
hour = var;
}

int noGet()
{
return no;
}
char* nameGet()
{
return name;
}
char* lastnameGet()
{
return lastname;
}
double salaryGet()
{
return salary;
}
int hourGet()
{
return hour;
}

double Bime()
{
return (salary * 7) / 100;
}
double Tax()
{
return (salary * 5) / 100;
}
double SalaryOnHour()
{
return salary * hour;
}
double TotalSalary()
{
return SalaryOnHour() - (Tax() + Bime());
}
};

void main()
{
Employ person;
int x;
double y;
char z[40];
cout << "Please Enter Data For Employ ... " << endl << "Employ id : ";
cin >> x;
person.noSet(x);

cout << "Employ Name : ";


cin >> z;
person.nameSet(z);

cout << "Employ Lastname : ";


cin >> z;
person.lastnameSet(z);

cout << "Employ Salary : ";


cin >> y;
person.salarySet(y);
cout << "Employ Hour : ";
cin >> x;
person.hourSet(x);
cout << endl;

cout << "Employ : " << person.noGet() << " - " << person.nameGet() << " " <<
person.lastnameGet() << " ~ Total Salary = " << person.TotalSalary() << endl;
}

You might also like