Code refactoring homework?
- by Hira
This is the code that I have to refactor for my homework:
if (state == TEXAS) {
rate = TX_RATE;
amt = base * TX_RATE;
calc = 2 * basis(amt) + extra(amt) * 1.05;
} else if ((state == OHIO) || (state == MAINE)) {
rate = (state == OHIO) ? OH_RATE : MN_RATE;
amt = base * rate;
calc = 2 * basis(amt) + extra(amt) * 1.05;
if…