Need help with taxes.
Dec 10, 2012 at 7:06pm UTC
I need to amend the code below so that tax can be deducted from interest. the programs needs to give an option at the start if to tax the interest. Tax rate should be %20. the output needs to be changed so that it shows tax deducted. this is what i have done so far.
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
#include <iostream>
using namespace std;
int main(){
int accBalance = 0;
float interestPaid = 0;
float interestRate = 0;
float totalBalance = 0;
int a;
char c;
cout << "Enter account balance : " ;
cin >> accBalance;
do {
cout<<a<<'\n' ;
cout<<"Should Interest be taxed?(Y/N):" ;
cin>>c;
} while (c=='y' ||c=='Y' );
if ( accBalance <= 1000 || accBalance > 0 ){
interestRate = 0.02;
interestPaid = interestRate * accBalance;
totalBalance = accBalance + interestPaid ;
}
else if ( accBalance > 1000 ){
interestRate = 0.05;
interestPaid = interestRate * accBalance;
totalBalance = accBalance + interestPaid ;
}
cout << "Total Balance : " << totalBalance << endl;
cout << "Interest Rate : " ;
if ( accBalance <= 1000 )
cout << "2%" << endl;
if (accBalance > 1000)
cout << "5%" << endl;
cout <<"Interest Paid : " << interestPaid << endl;
return 0;
}
Topic archived. No new replies allowed.