I am still pretty new to learning java and for an assignment I was given a set of data to run with my code.
After inputting some of the data, this exception appeared
I can't figure out why an exception is being thrown after I prompt user for money tended by the customer. Help is appreciated. Here is my code below:
public class cashRegister 
{
    public static void main(String[] args)
    {
        //represents the sale amount
        double saleAmt;
        //represents amount of money given by customer
        double cusTend;
        //represents customer's change 
        double cusChange = 0;
        //Collects sale amount from user
        Scanner customerIn = new Scanner(System.in);
        System.out.println("Please enter the sale amount");
        saleAmt = customerIn.nextDouble();
        //Collects amount tended 
        System.out.println("Please enter amount tended by the customer");
        cusTend = customerIn.nextDouble();
        //Outputs customer's total change
        cusChange = cusTend - saleAmt;
        System.out.printf("Total Change: %.2f", cusChange,"\n");
        //Splits change into Dollars and Cents 
        DecimalFormat decimalFormat = new DecimalFormat();
        String moneyString = decimalFormat.format(cusChange);
        String[] parts = moneyString.split("\\.");
        String part2 = parts[1]; //ArrayIndexOutOfBoundException here
        String dollars= parts[0];
        double cents5 = Double.parseDouble(part2);
        //Divides change by amount
        int cents = (int)cents5;
        int quarters = cents / 25;
        int cents1 = cents % 25;
        int dimes = cents1 / 10;
        int cents2 = cents % 10;
        int nickels = cents2 / 5;
        int cents3 = cents % 5;
        int pennies = cents3;
        //Out prints the amount of dollars, quarters, dimes, nickles, and pennies 
        System.out.printf("\n"+ "Dollars :"+ dollars + "\n" );
        System.out.printf("Quarters :" + quarters + "\n");
        System.out.printf("Dimes :"+ dimes +"\n");
        System.out.printf("Nickles :" + nickels +"\n");
        System.out.printf("Pennies :" + pennies + "\n");
    }
}


 
    