Quote:
|
Originally Posted by krisl100 Code: #include "string"
#include "iostream"
#include "conio.h" |
What is this part for?? You are trying to use system provided includes, so you need to address them as such ie
Code:
#include <string>
#include <iostream>
And why are you including
conio.h ?? I see no part of your code in need of that, unless you're on a windows box, and you feel strongly attached to
getch() there are ways to come around a halt in your program, without calling a system specific function.
Next thing is, you have declared the first name and last name of type strings, and you use the
std::cin class representation of reading into string types, I would suggest to use the
std::string::getline() in case someone decides to enter a <space> in their input.
If you were to move the
com calculation inside your
Code:
if (sales > 200.00)
then you would be in better shape, and not have to refere to your hardcoded $1000.00 value, as I suspect this shoudl be the actual sale value..
For your description of it, the if() part would be more suited to look somethign like:
Code:
...
double sales, pay, com(0.0);
...
if(sales > 200)
com = (sales - 200.00) * 0.06;
pay = base + com;
...
you see, in your declaring of the
com variable you already assing it the least possible value, ie $0.00, so you only have to calculate it, if the sales is above your $200.00 limit.
When you want to calculate your
net pay you can use the
simple percentage rules, to calculate it like:
Code:
...
double net;
...
net = pay*0.82; /* gross pay - 18% */
...
And from there on, I belive it should be fairly easy to calculate the housing, food & clothing, entertainment, and miscellaneous..
Have fun with it, and try not to get cought up in a simple problem, think of it as learning a different language, if you dont quite know the words for what you're going to say, find others that eventualy will describe the same thing, and hopefully provide a solution which gives teh same result as expected.