что происходит на самом деле в вашем коде,
public void calculateNewBalance()
{
if (accountType.equals("S") || accountType.equals("s"))
{
accountType = "Savings";
calculateSavingsBalance();
} else if (accountType.equals("C") || accountType.equals("c"))
{
accountType = "Checking";
calculateCheckingBalance();
}
}
для s или S accountType = "Savings";
для c или C accountType = "Проверка";
, но интересно в isServiceCharge () метод
public void isServiceCharge()
{
if(accountType.equals("s") || accountType.equals("S"))
{
double newBalance = currentBalance - 10.0;
JOptionPane.showMessageDialog(null, "Account Number: " + getAccountNumber() + "\nAccount Type: " + getAccountType() + "\nMinimum Balance: $" + getMinSavings()
+ "\nBalance Before Interest and Fees: $" + getCurrentBalance() + "\n\nNew Balance: $" + newBalance);
}
else if(accountType.equals("c") || accountType.equals("C"))
{
double newBalance = currentBalance - 25.0;
JOptionPane.showMessageDialog(null, "Account Number: " + getAccountNumber() + "\nAccount Type: " + getAccountType() + "\nMinimum Balance: $" + getMinSavings()
+ "\nBalance Before Interest and Fees: $" + getCurrentBalance() + "\n\nNew Balance: $" + newBalance);
}
}
вы проверили
accountType.equals("s") || accountType.equals("S") //for savings
accountType.equals("C") || accountType.equals("c")// for checking
, поэтому вышеуказанное условие никогда не будет соответствовать.
, поэтому решение:
public void isServiceCharge()
{
if(accountType.equals("Savings"))
{
double newBalance = currentBalance - 10.0;
JOptionPane.showMessageDialog(null, "Account Number: " + getAccountNumber() + "\nAccount Type: " + getAccountType() + "\nMinimum Balance: $" + getMinSavings()
+ "\nBalance Before Interest and Fees: $" + getCurrentBalance() + "\n\nNew Balance: $" + newBalance);
}
else if(accountType.equals("Checking"))
{
double newBalance = currentBalance - 25.0;
JOptionPane.showMessageDialog(null, "Account Number: " + getAccountNumber() + "\nAccount Type: " + getAccountType() + "\nMinimum Balance: $" + getMinSavings()
+ "\nBalance Before Interest and Fees: $" + getCurrentBalance() + "\n\nNew Balance: $" + newBalance);
}
}