Here is a sample payroll program that I wrote for my programming class before a long time ago that uses object oriented programming approach it uses class to declare, use and process variables in our program. I hope my work is useful to your learning in C++ programming.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Program Listing
#include <iostream>
#include <iomanip>
using namespace std;
class payroll {
private:
string name;
int days_work;
float rate;
float solve;
public :
int get_info();
void display_info();
};
int payroll :: get_info()
{
cout << "\t\t Simple Payroll System Using OOP in C++";
cout << "\n\n";
cout << "Enter Employees Name : ";
getline(cin,name);
cout << "Enter No. of Days Worked : ";
cin >> days_work;
cout << "Enter Daily Rate : ";
cin >> rate;
cout << fixed << setprecision(2);
solve = (days_work * rate);
}
void payroll ::display_info()
{
cout << "\n\n";
cout << "==== DETAILED REPORT =====";
cout << "\n\n";
cout << "\nEmployees Name : " << name;
cout << "\nEmployees Salay is : $" << solve;
cout << "\n\n";
system("pause");
}
main() {
payroll emp;
emp.get_info();
emp.display_info();
}
No comments:
Post a Comment