help....

help....help....help....Y answer is not right??

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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
//#include <coino.h>
using namespace std;

void calcution(double hour, double payrate, double regularpay, double overpay, double grosspay);
void calcution(double grosspay, double fedtaxwithheld, double stataxwithheld, double fedtaxrate, double stataxrate);
void calcution(double grosspay, double fedtaxwithheld, double stataxwithheld, double sstaxwithheld, double medtaxwithheld, double netpay);
int main()
{
	int choice;
	string employeename, employeeid;
	double hour, payrate, fedtaxrate, stataxrate;
	double regularpay, overpay, grosspay, fedtaxwithheld, stataxwithheld;
	double sstaxwithheld, // social security taxes withhel
		medtaxwithheld,  // medicare texes withhel
		netpay;
	char answer;
	bool again=true;
	
	cout<<"Enter the Employee's name: ";
	getline(cin, employeename, '\n');
	cout<<"Enter the Employee's ID: ";
	getline(cin, employeeid, '\n');
	cout<<"Enter the Worked Hour: ";
	cin>>hour;
	hour=abs(hour);
	if (hour==0 or hour>100)
		hour=40;
	cout<<"Enter the Pay Rate: ";
	cin>>payrate;
	payrate=abs(payrate);
	cout<<"Enter the Federal Taxes Rate: ";
	cin>>fedtaxrate;
	fedtaxrate=abs(fedtaxrate);
	if (fedtaxrate>0.5)
		fedtaxrate=0.2;
	cout<<"Enter the State Tax Rate: ";
	cin>>stataxrate;
	stataxrate=abs(stataxrate);
	if (stataxrate>0.3)
		stataxrate=0.2;

	system("cls");
	cout<<"1-9 Regular Pay\n"
		"2-9 Overtime Pay\n"
		"3-9 Gross pay\n"
		"4-9 Federal Taxes Withheld\n"
		"5-9 State Taxes Withheld\n"
		"6-9 Social Security Taxex Withheld\n"
		"7-9 Medicare Taxes Withheld\n"
		"8-9 Net Pay\n"
		"9-9 All Payroll\n"
		"0-9 quit";
		
		while (again)
		{
			cout<<"\n\nEnter Your Choice(0-9): ";
			cin>>choice;
			switch(choice)
			{
				case 1:
					cout<<"Regular Pay: $"<<regularpay;
					break;
				case 2:
					cout<<"Overtime Pay: $"<<overpay;
					break;
				case 3:
					cout<<"Gross Pay: $"<<grosspay;
					break;
				case 4:
					cout<<"Federal Taxes Withheld@"<<fedtaxrate<<"%"<<": $"<< fedtaxwithheld;
					break;
				case 5:
					cout<<"State Taxes Withheld@"<<stataxrate<<"%"<<": $"<<stataxwithheld;
					break;
				case 6:
					cout<<"Social Security Taxex Withheld: $"<<sstaxwithheld;
					break;
				case 7:
					cout<<"Medicare Taxes Withheld: $"<<medtaxwithheld;
					break;
				case 8:
					cout<<"Net Pay: $"<<netpay;
					break;
				case 9:
					cout<<"Regular Pay:\t\t\t\t$"<<regularpay;
					cout<<"\nOvertime Pay:\t\t\t\t$"<<overpay;
					cout<<"\nGross Pay:\t\t\t\t$"<<grosspay;
					cout<<"\nFederal Taxes Withheld@"<<fedtaxrate<<"%"<<":\t\t$"<< fedtaxwithheld;
					cout<<"\nState Taxes Withheld@"<<stataxrate<<"%"<<":\t\t$"<<stataxwithheld;
					cout<<"\nSocial Security Taxex Withheld:\t\t$"<<sstaxwithheld;
					cout<<"\nMedicare Taxes Withheld:\t\t$"<<medtaxwithheld;
					cout<<"\nNet Pay:\t\t\t\t$"<<netpay;
					break;
				case 0:
					exit(0);
				default:
					cout<<"Error! Please Enter a number through 0 to 9: ";
			}
		}
		cout<<"Do you Choose Again(y/n): ";
		cin>>answer;
		answer=toupper(answer);
		if (answer!='y' and answer!='Y')
			again=false;
			
	return 0;
}

void calcution(double hour, double payrate, double fedtaxrate, double stataxrate, double regularpay, double overpay, double grosspay)
{
	if (hour<40)
		regularpay=hour*payrate;
	else
		overpay=(hour-40)*payrate;
	grosspay=regularpay+overpay;
				  
}
void calcution(double grosspay, double fedtaxwithheld, double stataxwithheld, double fedtaxrate, double stataxrate)
{
	fedtaxwithheld=grosspay*fedtaxrate;
	stataxwithheld=grosspay*stataxrate;
}
void calcution(double grosspay,double fedtaxwithheld, double stataxwithheld, double sstaxwithheld, double medtaxwithheld, double netpay)
{
	sstaxwithheld=grosspay*0.062;
	medtaxwithheld=grosspay*0.0145;
	netpay=grosspay-fedtaxwithheld-stataxwithheld- sstaxwithheld-medtaxwithheld;
}
> Y answer is not right??
tell us what you want the program to do, and what it actually does.

Also, read the warnings. You are using uninitialized variables, and performing operations with no side effect.
i am a noob in C++...can u tell me what should i do?
tell us what you want the program to do, and what it actually does.

Answering that question does not require any knowledge of C++ or any other programming language. In other words, what is the purpose of the program and what is it supposed to, or not supposed to do? What does it actually do? If I c&p'd it and it compiled, what kind of input should I give it? What kind of answer should I expect? How would I even know the answer is wrong?
Topic archived. No new replies allowed.