I'm trying to create a program that calculates net from gross pay - taxes...however after I enter my gross pay the program closes out...can anyone help me figure out what is wrong with my code?
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double inputGross = 0.0;
double FED_RATE = .2;
double STATE_RATE = .05;
//assign the int data type to each variable
int gross = 0;
double federalTax = 0;
double stateTax = 0;
int net = 0;
cout << "Gross pay: ";
cin >> inputGross;
//multiply inputGross by 100, assigning the result (as an integer) to gross
gross = inputGross * 100;
//multiply gross by FED_RATE, then add .5; assign the result (as an integer) to federalTax
federalTax = gross * FED_RATE + .5;
//multiply gross by STATE_RATE, then add .5; assign the result (as an integer) to stateTax
stateTax = gross * STATE_RATE + .5;
net = gross - federalTax - stateTax;
//display the gross, federalTax, stateTax, and net
//divide each value by 100.0 before displaying
gross /= 100.0;
federalTax /= 100.0;
stateTax /= 100.0;