I have used a Scanner so that if the user puts in Dark Knight or Joker, it will follow a different series. However, if they put something other than that, I need it to print "Member Level not found" and stop the program overall but instead of doing that, it just continues and prints out at the end of the program. I provided my block below. Thank you!
if (level.equalsIgnoreCase("Dark Knight"))
{
totalInterest = interestDK;
if (late.equalsIgnoreCase("Yes")){
totalInterest += 0.01;
// LATE FEE MATH FOR DK SHOULD BE HERE
}
else if (late.equalsIgnoreCase("No")){
System.out.println("Interest for on-time payment: (" + totalInterest + "% of principle): " + totalInterest * currentBalance);
}
else if (level.equalsIgnoreCase("Joker"))
{
totalInterest = interestJoker;
if (late.equalsIgnoreCase("Yes")){
totalInterest += 0.01;
lateFee += 10.00;
}
if (lateFee != 0.00){
System.out.println("Late fee: $10.00");
}
else if (late.equalsIgnoreCase("No")){
System.out.println("Interest for on-time payment: (" + totalInterest + "% of principle): " + totalInterest * currentBalance);
}
else{
System.out.println("Member level not found. Must be Dark Knight or Joker.");
return;
}
}
Aucun commentaire:
Enregistrer un commentaire