help guys...please..

anyone can help for the code of c++ payroll?? help master please..
the result should goes like this..

Please input your name:
Please input your salary:
Please input no of days work:
Deduction
SSS (3%)
BIR (5%)
Philhealth (6%)
Pag ibig (2%)

Your account name is:
Your salary per week is:
Your salary per month is:
Net monthly income is:
Net annual income is:
Total deduction

Please help guys..Our professor never teach us.he never discuss us about dis part..hope someone can help to do the codings..:-c
Sorry about your professor, I've had my share. Maybe you can check out some youtube videos or something. Hopefully your book is good.

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
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string name;
        double salary, deduction;
        short days_worked_per_week;
        
        cout << "Input you name: ";
        cin >> name;
        cout << "Input salary: ";
        cin >> salary;
        //....get any other inputs you need
        
        double weekly_salary = salary*days_worked_weekly//assuming the salary is per day
        double monthly_salary = //include formula here
        //...include any other formulas here

        cout << "Your name is: " << name << endl;
        cout << "Your salary per week is: " << weekly_salary << endl;
        //...display any other ouput you need to display
	

	return 0;
}
thx for your reply..as of now, i dont know the use of short..and when and how to use double..i dont know how to defend it..here's my code but stil incomplete coz i dont know how to extend d coding after return 0..

#include<iostream.h>
int main()
{
char james[20];
int a,b,philhealth,bir,pagibig,salary,c,d,e;
int pay (int b);

cout<< "Please input your name:\n";
cin>>james;
cout<< "Please input your salary:\n";
cin>>salary;

cout<< "Please input no of days work:\n";
cin>>a;

b=(salary*a);
cout<<b;

return 0;
}

after dis, there is another computation for all deductions, computation is simple but d problem is i dont know how to input it in c++..='c
Last edited on
Just as a side note, when you post your code first click on the "<>" button to the right of where you write your posts under "format" and then proceed to write your code between the two sets of square brackets.

"double" and "short" are two different data types. When you want to store a variable you have to tell the computer if it's going to be a non-integer real number (for e.g. 1.23, 3.14159, 2.73) or strictly an integer. variables of "double" data type store non-integer real numbers where as variables of the "short" data type store integers. For storing the salary, for example, you would want to use a double because you want to be able to store values like 6.75 (USD/hr) for example, which is a non-integer real number.

return 0; is the final line the program executes. It tells a program to quit, basically. If you have more lines to add to this program then it would have to be before this line.

You should avoid naming your integers ambiguous names like "a," "b," etc., if not for your sake then for the people reading your code.

I suggest you scour online for more information. The information is very easy to come by on the internet. I haven't seen this entire video so I'm not sure I can recommend it but why don't you start here perhaps:
http://www.youtube.com/watch?v=nziy2_U5JQI
here's the code that i made..but still incomplete coz i dont know to extend my code after return 0

#include<iostream.h>
int main()
{
char james[20];
int a,b,philhealth,bir,pagibig,salary,c,d,e;
int pay (int b);

cout<< "Please input your name:\n";
cin>>james;
cout<< "Please input your salary:\n";
cin>>salary;

cout<< "Please input no of days work:\n";
cin>>a;

b=(salary*a);
cout<<b;

return 0;
}

the next coding should result this way..

salary-3% SSS -5% BIR -6% Philhealth -2% pag ibig

deductions:
SSS 3%
BIR 5%
Philhealth 6%
Pag ibig 2%

Your account name is:
You salary per week is;
your salarty per month is:
net monthly income is:
net annual income is:

computation is not that difficult, my problem is how i will insert it on c++ and the correct codings..

anyways, thx for your reply..please i need your help..am new here at c++
Are you saying that ss is 3% of salary, BIR is 5% of salary, etc?

If so then it should be something like this:

1
2
double BIR = salary * .03;
//other formulas 


I think you should elucidate your first post cause I'm not quite sure what the objective is.
may objective about this problem is..

to know the code after return 0..
I've already computed d monthly salary so what i need to know is how i will insert and what code i need to insert for the computation of..
SSS = (salary*.03)
BIR = (salary*.05)
Philhealth = (salary*.06)
Pagibig = (salary*.2)

thx for your reply..='D
The computation for above would be:

1
2
3
double sss = salary * .03;
double BIR = salary * .05;
//etc 


just insert them anywhere before return 0; and you should be fine, and display them of course using cout.
Topic archived. No new replies allowed.