I have read numerous posts and pages about while loops and such, I just cannot understand where to place a loop to repeat this until one of the three conditions is met. If someone could just point to the places I need to add a while-do or whatever I would greatly appreciate that, no need to print out any code unless you want to.
System.out.print("Customer name: ");
name=scan.next();
System.out.print("Customer member level: ");
level=scan.next();
if (level.equalsIgnoreCase("Jedi"))
{
System.out.print("Current balance: ");
balance=scan.nextDouble();
System.out.print("Was the payment made late?: ");
late=scan.next();
if (late.equalsIgnoreCase("Yes"))
{
double interestLatePayment=(balance*0.02);
paymentToPrinciple=(balance*0.04);
totalPayment=(interestLatePayment+paymentToPrinciple);
percentToPrinciple=100*(paymentToPrinciple/totalPayment);
percentToInterest=(100-percentToPrinciple);
System.out.println("\nBill for "+level+" customer "+name);
System.out.printf("Card Balance: $%1.2f%n", balance);
System.out.printf("Interest for late payment (2.0%% of principle): $%1.2f%n", interestLatePayment);
System.out.printf("Minimum payment to principle (4%% of principle): $%1.2f%n", paymentToPrinciple);
System.out.printf("Minimum total payment (payment and fees): $%1.2f%n", totalPayment);
System.out.printf("Percent to principle: %1.1f%%n", percentToPrinciple);
System.out.printf("Percent to interest and fees: %1.1f%%n", percentToInterest);
}
else if(late.equalsIgnoreCase("No"))
{
double interestLatePayment=(balance*0.01);
paymentToPrinciple=(balance*0.04);
totalPayment=(interestLatePayment+paymentToPrinciple);
percentToPrinciple=100*(paymentToPrinciple/totalPayment);
percentToInterest=(100-percentToPrinciple);
System.out.println("\nBill for "+level+" customer "+name);
System.out.printf("Card Balance: $%1.2f%n", balance);
System.out.printf("Interest for on-time payment (1.0%% of principle): $%1.2f%n", interestLatePayment);
System.out.printf("Minimum payment to principle (4%% of principle): $%1.2f%n", paymentToPrinciple);
System.out.printf("Minimum total payment (payment and fees): $%1.2f%n", totalPayment);
System.out.printf("Percent to principle: %1.1f%%n", percentToPrinciple);
System.out.printf("Percent to interest and fees: %1.1f%%n", percentToInterest);
}
}
if (level.equalsIgnoreCase("Padowan"))
{
System.out.print("Current balance: ");
balance=scan.nextDouble();
System.out.print("Was the payment made late?: ");
late=scan.next();
if (late.equalsIgnoreCase("Yes"))
{
double interestLatePayment=(balance*0.028);
paymentToPrinciple=(balance*0.04);
totalPayment=(interestLatePayment+paymentToPrinciple);
percentToPrinciple=100*(paymentToPrinciple/totalPayment);
percentToInterest=(100-percentToPrinciple);
lateFee=10;
System.out.println("\nBill for "+level+" customer "+name);
System.out.printf("Card Balance: $%1.2f%n", balance);
System.out.printf("Interest for late payment (2.8%% of principle): $%1.2f%n", interestLatePayment);
System.out.printf("Late fee: $%1.2f%n", lateFee);
System.out.printf("Minimum payment to principle (4%% of principle): $%1.2f%n", paymentToPrinciple);
System.out.printf("Minimum total payment (payment and fees): $%1.2f%n", totalPayment);
System.out.printf("Percent to principle: %1.1f%%n", percentToPrinciple);
System.out.printf("Percent to interest and fees: %1.1f%%n", percentToInterest);
}
else if(late.equalsIgnoreCase("No"))
{
double interestLatePayment=(balance*0.018);
paymentToPrinciple=(balance*0.04);
totalPayment=(interestLatePayment+paymentToPrinciple);
percentToPrinciple=100*(paymentToPrinciple/totalPayment);
percentToInterest=(100-percentToPrinciple);
System.out.println("\nBill for "+level+" customer "+name);
System.out.printf("Card Balance: $%1.2f%n", balance);
System.out.printf("Interest for late payment (1.8%% of principle): $%1.2f%n", interestLatePayment);
System.out.printf("Minimum payment to principle (4%% of principle): $%1.2f%n", paymentToPrinciple);
System.out.printf("Minimum total payment (payment and fees): $%1.2f%n", totalPayment);
System.out.printf("Percent to principle: %1.1f%%n", percentToPrinciple);
System.out.printf("Percent to interest and fees: %1.1f%%n", percentToInterest);
}
}
if (level.equals("Youngling"))
{
System.out.print("Current balance: ");
balance=scan.nextDouble();
System.out.print("Was the payment made late?: ");
late=scan.next();
if (late.equalsIgnoreCase("Yes"))
{
double interestLatePayment=(balance*0.035);
paymentToPrinciple=(balance*0.04);
totalPayment=(interestLatePayment+paymentToPrinciple);
percentToPrinciple=100*(paymentToPrinciple/totalPayment);
percentToInterest=(100-percentToPrinciple);
lateFee=20;
System.out.println("\nBill for "+level+" customer "+name);
System.out.printf("Card Balance: $%1.2f%n", balance);
System.out.printf("Interest for late payment (3.5%% of principle): $%1.2f%n", interestLatePayment);
System.out.printf("Late fee: $%1.2f%n", lateFee);
System.out.printf("Minimum payment to principle (4%% of principle): $%1.2f%n", paymentToPrinciple);
System.out.printf("Minimum total payment (payment and fees): $%1.2f%n", totalPayment);
System.out.printf("Percent to principle: %1.1f%%n", percentToPrinciple);
System.out.printf("Percent to interest and fees: %1.1f%%n", percentToInterest);
}
else if(late.equalsIgnoreCase("No"))
{
double interestLatePayment=(balance*0.025);
paymentToPrinciple=(balance*0.04);
totalPayment=(interestLatePayment+paymentToPrinciple);
percentToPrinciple=100*(paymentToPrinciple/totalPayment);
percentToInterest=(100-percentToPrinciple);
System.out.println("\nBill for "+level+" customer "+name);
System.out.printf("Card Balance: $%1.2f%n", balance);
System.out.printf("Interest for late payment (2.5%% of principle): $%1.2f%n", interestLatePayment);
System.out.printf("Minimum payment to principle (4%% of principle): $%1.2f%n", paymentToPrinciple);
System.out.printf("Minimum total payment (payment and fees): $%1.2f%n", totalPayment);
System.out.printf("Percent to principle: %1.1f%%n", percentToPrinciple);
System.out.printf("Percent to interest and fees: %1.1f%%n", percentToInterest);
}
}
else
{
System.out.print("Invalid member level. Enter valid member level: ");
}
}
}