Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include "stdafx.h"
#include "iostream"
using namespace std;
class Employ
{
int no;
char name[40];
char lastname[40];
int age;
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 ageSet(int var)
{
age = 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;
}
int ageSetGet()
{
return age;
}
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 Age : ";
cin >> x;
person.ageSet(x);
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.