I'm trying to program a try/catch exception while loop that continues till the user enters x to exit. So far i've gotten it to work but i'm having one issue with the console printing "Account x cannot be found" before the program exits.
/** Murach, J. and Steelman, A., ( 2007). Murach’s Java SE6, Training and Reference. Fresno, CA: Mike Murach & Associates. Modifications by Wm Bowers, 2007 – 2011 CustomerApp.java interacts with Customer, CustomerIO, Validator and NoSuchNumberException STARTER Class */ import java.util.Scanner; public class CustomerApp { public static void main(String args[]) { PriceHeading.getHeading("Assignment 3");//heading call // display a welcome message System.out.println(" Welcome to the Customer application"); System.out.println(); // create the Scanner object Scanner sc = new Scanner(System.in); // continue until user enters x String custNo = "y"; while (!custNo.equalsIgnoreCase("x")) { custNo = Validator.getString(sc, " Enter a customer number (or an \"X\" to quit) -> "); try { Customer cust = CustomerIO.getCustomer(custNo); System.out.println("\n" + cust.getNameAndAddress()); } catch (NoSuchCustomerException e){ System.out.println(e.getMessage()); } } System.out.println(); } }public class Customer { public String name, address, city, state, zipCode; public String getNameAndAddress() { return " " + name + "\n\t\t " + address + "\n\t\t " + city + ", " + state + " " + zipCode; } }class NoSuchCustomerException extends Exception { private String customerNumber; public NoSuchCustomerException() { } public NoSuchCustomerException(String customerNumber){ super(" The customer number " + customerNumber.toUpperCase() + " does not exist"); } public String getCustomerNumber(){ return customerNumber; } }