How to work out %20 in c++

Need help working out 20% of the interest. the program asks if to tax interest the user selects y or n, but need help on how to work out %20 of the interest then display how much tax was deducted in tax.

Relevant code imo.

case 'y':
tax = interestPaid /
break;
case 'n':
/// enter in here what you want it to do if user puts n
break;
default:
cout << "invalid input" << endl;
break;
}


All the code 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
45
46
47
48
49
50
51
#include <iostream>
using namespace std;

int main(){
      int accBalance = 0;
      float interestPaid = 0;
      float interestRate = 0;
      float totalBalance = 0;
      char taxes;
      int tax

      cout << "Enter account balance : ";
      cin  >> accBalance;
      cout << "Tax the interest(y/n)? ";
      cin >> taxes;


      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 ;
      }

      switch(taxes){
      case 'y':
          tax = interestPaid /
      break;
      case 'n':
        /// enter in here what you want it to do if user puts n
      break;
      default:
      cout << "invalid input" << endl;
      break;
      }

      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.