I think there's a problem in your nesting of the Interest Calculations part. I think you need an additional nesting level.
Now, if I have a C account with €2000, I will get these steps:
a) First if (l52): pass -> get 2% interest.
b) First else (l58): skipped.
c) Second if (l65): fail, skipped.
d) Second else (l71): pass -> get 4.5% interest.
Your structure should look like this:
1 2 3 4 5 6 7 8
|
if (ACCT == 'C') {
if (BAL < 3000) // 2% interest
else // 2.5% interest
}
if (ACCT == 'S') {
if (BAL < 10000) // 3% interest
else // 4.5% interest
}
|
That should fix things.
Pro-tip:
Big if-else nesting can be solved by using switch()! Especially your input (D, W, I, Q) is a perfect candidate for this!
Pro-tip 2: You have a lot of duplicate code (e.g. l52 ->l76). Why not make a single function and call it several times?