so lost

I am extremelly new to C++ and I am lost. I have to write a code to take the taxes out of a base pay. Sounds easy but I am doing something so wrong that the output just bypasses everything but the employees name. Can someone point me in the right direction?

[code]
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

const double Federal_Income_Tax = .15;
const double State_Tax = .035;
const double Social_Security_Medicare_Tax = .085;
const double Health_Insurance = 75;

int main()

{
int Employee;
int BasePay;

cout << "Enter the employee's name : ";
cin >> Employee;
cout << endl;

cout << "Enter the base pay : ";
cin >> BasePay;
cout << endl;

int Federal = 0;
int State = 0;
int Social = 0;
int Health;
int Net;

Federal = (double)BasePay*Federal_Income_Tax;
cout << "Federal Tax: ............$" << Federal << endl;

State = (double)BasePay*State_Tax;
cout << "State Tax: ..............$" << State << endl;

Social = (double)BasePay*Social_Security_Medicare_Tax;
cout << "Social Sec / Medicare; ..$" << Social << endl;

Health = Health_Insurance;
cout << "Health Insurance: .......$" << Health << endl;


Net = (double)BasePay-Federal-State-Social-Health;
cout << "Net Pay .................$" << Net << endl;



return 0;

}

What do you want your program to do?
Why do you want to store Employee's name as int?
If the first input is wrong, the rest of the input in your program will fail.
I need it to do the following:

Ask for Employee name
Ask for Base Pay
Calculate Federal, State, Social tax from base pay
Calculate Net pay from taxes

I can only get it to ask for the employee name
You can do it like this:

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
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

const double Federal_Income_Tax = .15;
const double State_Tax = .035;
const double Social_Security_Medicare_Tax = .085;
const double Health_Insurance = 75;

int main()

{
char Employee[256];
int BasePay;

cout << "Enter the employee's name : ";
cin.get(Employee, 256);
cout << endl;

cout << "Enter the base pay : ";
cin >> BasePay;
cout << endl;

int Federal = 0;
int State = 0;
int Social = 0;
int Health;
int Net;

Federal = (double)BasePay*Federal_Income_Tax;
cout << "Federal Tax: ............$" << Federal << endl;

State = (double)BasePay*State_Tax;
cout << "State Tax: ..............$" << State << endl;

Social = (double)BasePay*Social_Security_Medicare_Tax;
cout << "Social Sec / Medicare; ..$" << Social << endl;

Health = Health_Insurance;
cout << "Health Insurance: .......$" << Health << endl;


Net = (double)BasePay-Federal-State-Social-Health;
cout << "Net Pay .................$" << Net << endl;



return 0;

}
Thought I had to, I have no knowledge of this stuff at all. I am taking the class online and have been reading the text book and sites here on the web and watching youtube videos but I can not grasp this
char Employee[256] - Is an array of type char that can hold up to 256 characters.

And for the input read this: http://www.cplusplus.com/reference/istream/istream/get/

and if it helps, i have also taught my self the things i know about C++ today.
Last edited on
Thank You
Topic archived. No new replies allowed.