Hello all i get an error in cygwin @ line 61 "error expected ";" before "income_tax". I have no idea what the problem is and im fairly new to c++ and coding in general. This is a homework assignment in my structured programing class to fig error in some code. Any Help would be appreciated.
//*
//* This program takes in the salary of the employee from standard input.
//* It then deducts the income tax from the salary on the following basis :
//* 30% income tax if the salary is above $15000.
//* 20% income tax if the salary is between $7000 and $15000.
//* 10% income tax if the salary is below $7000.
//* The salary, income tax and the net salary is then outputted to standard output.
//*/
#include <iostream>
#include <iomanip>
#include <cctype>
using std::cout;
using std::cin;
using std::setw;
using std::endl;
using std::fixed;
using std::setprecision;
int main()
{
char answer;
int tax_rate = 0;
double salary = 0;
double income_tax = 0;
double net_salary = 0;
//do-while loop that allows the user to calculate the net salary for more than one
//employee
do{
//prompt user for salary and read it in
cout << "Enter the salary : ";
cin >> salary;
//check and make sure we got a positive salary
//if not tell the user they made a mistake and ask again
while(salary < 0);{
cout << "The employess salary must be non-negative!" << endl;
cout << "Enter the salary : ";
cin >> salary;
}
//calculate tax rate and income tax based on table at the top of this file.
if(salary>15000){
income_tax=salary*30;
tax_rate==30;
}if(salary>=7000){
income_tax=salary*20/100;
tax_rate==20;
}else
income_tax=salary*10/100;
tax_rate==10;
//calculate net salary
net_salary=salary+income_tax;
//ouput everything to user
cout << fixed << setprecision (2);
cout << "Salary = $" << salary << endl;
cout << "Your income tax @ " << tax_rate << "% = $ " income_tax << endl;
cout << "Your net salary = $" << net_salary << endl;
//check to see if the user wants to repeat the process
cout << "Enter a Y to calculate the net salary of another employee or any other character to exit: ";
//ignore the whitespace left from previous cin statements
cin.ignore();
cin.get(answer);
//convert answer to lowercase -- makes comparisons easier
answer = tolower(answer);
}while(answer = 'y');
return 0;
}