Its been long since my last post codescharters. This time I will teach on how to create a simple payroll system using c++ with flowchart and a free source code. Before you continue on reading have you been wandering the needs of learning payroll system of all sudden.
Benefits of learning a Simple Payroll System
Learning is fun? Yes, it is and it is more fun loving knowing that you'll get benefits of learning something new. Simple payroll system using c++ are some how next to teach in programming classes after a simple grading system. In learning a simple payroll system you'll be aware to much more complexe logic in programming. Because you'll meet passing values to other integers.
Companies are looking for Finance or Payroll System Programmer.
Most companies are in need of programmers which is knowledgeable in finance or payroll system. Why, because their clients are in need of a payroll system that won’t stress out their employees who are making it. More often reason is they are processing a large amount of payroll of employees depends on how big a company is. Also if you really planned to go to programming industry its good idea to add a payroll system in your own portfolio, considering that you already have knowledge in the specific knowledge makes the job interview in much faster way with no more talking.
Payroll system is the most bases of For Entry Level Programmers.
As you read before in job interview if you successfully passed from the companies human resource. Soon you’ll get to be interviewed by one of their senior programmers. That’s when you’ll be asked if your have a knowledge in payroll system.
|
Simple Payroll System using C++ with flowchart and free source code. |
Simple Payroll System Free Source Code
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
| /*
Name: Simple Payroll System
Copyright: Codes Chart
Author: Jerome E. Eno
Date: 22/05/18 14:22
Description: A simple payroll system of daily rate and monthly rate.
Like and Share Codes Chart's official FB Page at
"www.facebook.com/codeschart",
and Subscribe my devlog site "codeschart.blogspot.com"
*/
#include <iostream> // include input/output stream.
using namespace std; // to get rid of std:: in using 'cout'.
int main() { // your main function.
// declaring intergers and their default value.
int DorM=0,salary, hw, dw, totalnet=0, rate; // intergers with =0 have a default value of 0 but those none has a default value of 1.
int SSS, PhilHealth, Tax, totaldeduc=0;
// this is the first out put in your program.
cout<<"Choose if Daily Rate or Monthly Rate"<<endl;
cout<<"[1] Daily Rate"<<endl;
cout<<"[2] Monthly Rate"<<endl;
cout<<"[3] Exit"<<endl;
cout<<"Select between 1 - 2: "; // you'll have to ask the user to enter a number 1 - 3.
cin>>DorM;
// if the user entered 1 make this condition true then it will be the next to process.
if(DorM == 1){
cout<<"--Payroll System -- Daily Rate--"<<endl; // to inform the user that he is now navigating the Payroll system of Daily rate.
// Enter the rate per day.
cout<<"Enter Rate: ";
cin>>rate;
// Enter the number of hours per day.
cout<<"Enter Hours of Work: ";
cin>>hw;
//Enter the number of days he/she worked.
cout<<"Enter Days of Work: ";
cin>>dw;
cout<<endl; // to make a blank space between or newline.
// to process his salary by multiplying his rate per day by days he/she worked.
salary = rate*dw;
SSS = salary*.05; //taking a 5% of the salary as deduction of SSS.
PhilHealth = salary*.05; // taking a 5% of the salary as deduction of PhilHealth.
Tax = salary*.05; // taking a 5% of the salary as deduction of Tax.
// after you take a value for SSS, PhilHealth and Tax this is where you subtract their value the the calculated salary.
salary = salary-SSS; // subtracting SSS value from salary.
salary = salary-PhilHealth; // subtracting PhilHealth value from salary.
salary = salary-Tax; // subtracting Tax value from salary.
totaldeduc = SSS+PhilHealth+Tax; // the compute the sum of all deducted value from salary
cout<<"Your SSS deduction: "<<SSS<<endl; // show SSS deduction rate by 5% of salary.
cout<<"Your PhilHealth deduction: "<<PhilHealth<<endl; // show PhilHealth deduction rate by 5% of salary.
cout<<"Your Tax deduction: "<<Tax<<endl; // show Tax deduction rate by 5% of salary.
cout<<endl; // to make a blank space between of newline.
cout<<"Total Deduction: "<<totaldeduc<<endl; // show the sum of total deduction of salary.
cout<<"Total Salary: "<<salary; // show total salary after deduction.
}
// if the user entered 2 make this condition true then it will be the next to process.
else if(DorM == 2){
cout<<"--Payroll System -- Monthly Rate--"<<endl; // to inform the user that he is now navigating the Payroll system of Monthly rate.
// Enter rate per month of work.
cout<<"Enter Rate: ";
cin>>rate;
//Enter hours of work per day
cout<<"Enter Hours of Work: ";
cin>>hw;
// Enter days of worked.
cout<<"Enter Days of Work: ";
cin>>dw;
cout<<endl;
// passing the value of integer rate to integer salary.
salary = rate;
SSS = salary*.05;
PhilHealth = salary*.05;
Tax = salary*.05;
salary = salary-SSS;
salary = salary-PhilHealth;
salary = salary-Tax;
totaldeduc = SSS+PhilHealth+Tax;
cout<<"Your SSS deduction: "<<SSS<<endl;
cout<<"Your PhilHealth deduction: "<<PhilHealth<<endl;
cout<<"Your Tax deduction: "<<Tax<<endl;
cout<<endl;
cout<<"Total Deduction: "<<totaldeduc<<endl;
cout<<"Total Salary: "<<salary;
}
// this means that even the user did not enter 3, as long as he entered a different value other than 1 and 2 this will show.
else {
cout<<"Like and Share Codes Chart FB Page ans Subscribe to my blog THANK YOU!!!";
}
return 0; // return a value of zero.
}
|
How it works:
First include input/output stream then declare using namespace std; to get rid off std:: commands before cout from your payroll system. Why don’t you try to not use namespace std and see what happens to your payroll system. Then declare the main function of your simple payroll system. The main function serves as the main process of your simple payroll system or platform. Then once you had already declared the main function of your simple payroll system declare integers that hold all possible numbers that your user may wish to enter. On declared integers their some with equal zero. That means those integers from your payroll system have a default value of zero and those none has a default value of one from your payroll system.
11
12
13
14
15
16
17
18
19
20
| #include <iostream>
using namespace std;
int main() {
int DorM=0,salary, hw, dw, totalnet=0, rate;
int SSS, PhilHealth, Tax, totaldeduc=0;
|
Now in this sample payroll system you’ll find that on your first process is that you are ask to choose from number one to three with different captions from this payroll system. On the number one option of this payroll system you have Daily rate means that the employee is earning in rate per day or pay per days of worked in this payroll system. On the second option of your simple payroll system you have Monthly rate means that your employee is earning in rate per month or pay for a month worked in this payroll system. And then finally the last option having a caption of exit means once you choose this you are wish to exit the simple payroll system program. It is a bit tricky because I do give number three as its option number but to tell the truth even you choose other number aside number three you’ll still exiting the simple payroll system program as long as you did not choose between number one and two.
23
24
25
26
27
28
| cout<<"Choose if Daily Rate or Monthly Rate"<<endl;
cout<<"[1] Daily Rate"<<endl;
cout<<"[2] Monthly Rate"<<endl;
cout<<"[3] Exit"<<endl;
cout<<"Select between 1 - 2: ";
cin>>DorM;
|
If you choose to enter number one as an option for daily rate for your payroll system to process. Then the first condition will be declared as true in this payroll system, and then you’ll going to follow the process of a payroll system for daily rate. If you set a selection or option or process it’s good to tell your users on what they are navigating or on what process they are up to, to let them know if they choose the process that they wish to or if they mistyped it’s a good idea including it in a programming system such as payroll system even if is not payroll system or different system.
31
32
33
| if(DorM == 1){
cout<<"--Payroll System -- Daily Rate--"<<endl;
|
Then you’ll have to ask the user to enter the rate per day for this payroll system, just remember since you choose the first option on this payroll system you must enter the rate per day or wages per days of worked. Don’t be confused to enter the monthly rate or it will not give your desired output of your payroll system. Then number of hours asking your users on how long they work for a single day. And there is the number of days asking your users of how many days they have already worked to multiply it to their wage per day in this payroll system.
35
36
37
38
39
40
41
42
43
| cout<<"Enter Rate: ";
cin>>rate;
cout<<"Enter Hours of Work: ";
cin>>hw;
cout<<"Enter Days of Work: ";
cin>>dw;
cout<<endl;
|
The process of this simple payroll system, this is the heart of your payroll system is. First you’ll pass the multiplied value of rate by days of work in an integer dw to integer salary. Then we are going to set of how much is the deduction you wish from salary from SSS, PhilHealth, Tax. First choose among the said deduction to begin, and then pass the multiplied salary by point zero point five (*.05) to your deduction integer from your payroll system. Then sum all deduction from your salary in your payroll system.
46
47
48
49
50
51
52
53
54
55
| salary = rate;
SSS = salary*.05;
PhilHealth = salary*.05;
Tax = salary*.05;
salary = salary-SSS;
salary = salary-PhilHealth;
salary = salary-Tax;
totaldeduc = SSS+PhilHealth+Tax;
|
At last the final outputs on this sample payroll system. You’ll just have to present all calculated data to your users in your payroll system.
93
94
95
96
97
98
99
| cout<<"Your SSS deduction: "<<SSS<<endl;
cout<<"Your PhilHealth deduction: "<<PhilHealth<<endl;
cout<<"Your Tax deduction: "<<Tax<<endl;
cout<<endl;
cout<<"Total Deduction: "<<totaldeduc<<endl;
cout<<"Total Salary: "<<salary;
|
Exercises:
As you already run the source codes of payroll system above. You’ll find some things are missing. I want you to include late by hours and minutes, and then include under time by hours and minutes, and last include absences in monthly rate in your payroll system.
If you found this article useful feel free to Click the Button below.
hello i want to learn more about programming
ReplyDeleteHi, jandy at the moment I can't update post yet, since I am a employed IT. Thanks for this comment. I'll do my best to update more about programming.
DeleteThanks...
ReplyDeletecan i get the pseudo code of the program
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteNice idea for my next blog, thanks
DeleteThis comment has been removed by a blog administrator.
ReplyDeletethank you for supporting CodeChart
DeleteThis comment has been removed by a blog administrator.
ReplyDeletewhy not running
ReplyDeletewhat compiler are you using? try to use DevC++
DeleteWhere is the algorithm?
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteCan i get the flowchart
ReplyDelete