Hi All,
I Think I am close. I am trying to write a small user function that gives "roundCalc" to the main as a rounded number UP to the nearest 1000. (If 1011 should round up to 2000). I have "calcTotStat" reading in, and I thought I had it right, but my cout statement is returning 0.00. I know this is simple for all the experts, but after 10 hours yesterday on program 1 for class, and 3.5 hours today, I think my brain is fried.lol.
Thanks in advance,
#include <iostream>//I/o
#include <iomanip>//output manipulation library
#include <cctype>//function for character manipulation
#include <string>//string library
using namespace std;
//This finstion will round value from calculated line 6
//and will return a number rounded to nearest multiple of 1000
double round(double calcTotStat)// parameters for function
{
double roundCalc;
calcTotStat += .5;
roundCalc = (int) (calcTotStat / 1000);
roundCalc * 1000;
return (roundCalc); // return to main
}
//body of program will get user inputs for processing and calculations
//output text to user for inqueries
int main()
{
const double CHILD_ALLOWANCE = 1000;
const int SINGLE = 75000;
const int MARRIED_JOINT = 110000;
const int HEAD_HOUSE = 75000;
const int QUALIFY_WID = 75000;
const int MARRIED_SEP = 55000;
int children, fileStatus;
double childTaxPrevious, childAllow, remainCredit, grossAdjust, calcTotStat;
double roundCalc;
cout << "Enter the number of qualifying children: "; cin >> children; cout << endl;//ask for user input for children variable
cout << endl;
//calculate for line 1
childAllow = children * CHILD_ALLOWANCE;//calculation for number of children
//get amount from user for previous child tax credits
cout << "Enter any Advanced Child Tax Credit amount\n"
"(if none, enter 0): "; cin >> childTaxPrevious; cout << endl;
//calculate and determine user elgibility for child tax credits
//program exits with warning if conditions not met
//entry for line 3 if condition met
if (childTaxPrevious <= childAllow)
remainCredit = childAllow - childTaxPrevious;//calculation for elgibility determination
else {
cout << "\tSTOP--You cannot take this credit\n"
"\tYou have already received the maximum allowed"; cout << endl;//output to user if requirements not met
cout << endl;
system ("PAUSE");
return 3;//program exit with code 3
}
//get user input for line 4 adjusted gross
cout << "Enter your Adjusted Gross Income (1040, line 35): ";
cin >> grossAdjust; cout << endl;
cout << endl;
// get filing status from user
cout << "1 - Single"; cout << endl;
cout << "2 - Married, Filing Jointly"; cout << endl;
cout << "3 - Head of Household"; cout << endl;
cout << "4 - Qualifying Widow(er)"; cout << endl;
cout << "5 - Married, Filing Separately"; cout << endl;
cout << "Enter your filing statis from above 91-5): ";
cin >> fileStatus; cout << endl;//user input 1-5 for filing status
cout << endl;
//detrmine arguments and calculations for line 6 based on answer from files status
if (fileStatus == 1){
calcTotStat = SINGLE - grossAdjust;
round(calcTotStat);
}
cout << fixed << showpoint << setprecision(2);
cout << roundCalc; cout << endl;
cout << endl << endl;
system ("PAUSE");
return 0;
}