这是说我的局部变量newaccbalance
可能尚未初始化。我知道我宣布它是双重的。请帮忙
import java.util.*;
public class Pg244Problem12 {
public static void main(String[] args)
{
int accnum, minbalance, currentbalance;
int acctype;
double newaccbalance;
Scanner console = new Scanner(System.in);
System.out.println("Enter the customer's account number:");
accnum = console.nextInt();
System.out.println("Enter the customer's account type by using the number 1 for Checking or 2 for Savings:");
acctype = console.nextInt();
System.out.println("Enter the minimum balance the customer's account can have:");
minbalance = console.nextInt();
System.out.println("Enter the current balance of the customer's account:");
currentbalance = console.nextInt();
// Checkings
if(acctype == 1 && currentbalance >= (minbalance+5000)){
newaccbalance = ((currentbalance*.05)*(1/12));
}
if (acctype == 1 && currentbalance >= minbalance && currentbalance < (minbalance+5000)){
newaccbalance = ((currentbalance*.03)*(1/12));
}
if (acctype == 1 && currentbalance < minbalance){
newaccbalance = (currentbalance-25);
}
// Savings
if (acctype == 2 && currentbalance >= minbalance){
newaccbalance = ((currentbalance*.04)*(1/12));
}
if (acctype == 2 && currentbalance < minbalance){
newaccbalance = (currentbalance - 10);
}
System.out.println("The account number is: "+ accnum);
System.out.println("The account type is: "+ acctype);
System.out.println("The current balance is: "+ currentbalance);
System.out.println("The new account balance is: "+ newaccbalance);
}
}