I'm trying to figure whats wrong with my code. When I compile it says variable checkfee
might not have been initialized.
import javax.swing.JOptionPane;
public class BankCharge {
public static void main (String [] args) {
int check, basefee;
String temp;
double checkfee;
double totalfee;
basefee = 10;
totalfee = checkfee + basefee;
temp = JOptionPane.showInputDialog("Enter the number of checks");
check = Integer.parseInt(temp);
if (check < 20) {
checkfee = .10 * check;
JOptionPane.showMessageDialog(null, "Your amount for the month is " + totalfee);
}
if (check >= 20 && check <= 39) {
checkfee = .08 * check;
JOptionPane.showMessageDialog(null, "Your amount for the month is " + totalfee);
}
if (check >= 40 && check <= 59) {
checkfee = .06 * check;
JOptionPane.showMessageDialog(null, "Your amount for the month is " + totalfee);
}
}
}