I need help getting my programming assignment to print out the errors generated and also the dollars and cents of the sale price entered.

I have been using examples from class and also examples I have found online.

Here are my current files:

MJUnit6Ch15

Java Code:
import java.util.*; //Includes all java packages

public class MJUnit6Ch15 {

	public static void main(String[] args) {

		Scanner stdIn = new Scanner(System.in);
		String sale; //variable to hold the sale amount entered

		System.out.print("Please enter the amount of sale in form $#.## (\"q\" to quit): "); //asks the user to enter a string of characters
		sale = stdIn.nextLine(); //store the input

		while (!sale.equalsIgnoreCase("q")) {
			try {
				MJSaleCheck price = new MJSaleCheck(sale);

				System.out.println(price);
				System.out.println();

				price.getError();
				System.out.println(errors);

				System.out.print("Please enter the amount of sale in form $#.## (\"q\" to quit): "); //asks the user to enter a string of characters
				sale = stdIn.nextLine(); //store the input

			}
			catch (Exception ex){
				System.out.println("Unchecked exception!");
			}


		}

		//System.out.println(ex);

	}

}
MJSaleCheck

Java Code:
import java.util.Scanner;

public class MJSaleCheck {

    private int dollars;
    private int cents;
    private String errors; //Error string for any check fails


    public MJSaleCheck(String sale) throws Exception //Constructor Method
    {
        System.out.println("Beginning of SaleCheck\n");
        
        errors = null; //Object intialized with null
        try
        {
            if(sale.charAt(0) != '$') //Checks for "$"
            {
                errors = "Invalid sale format missing \"$\" - " + sale;
            }
            else
            {
                if (!sale.contains(".")) //Checks for "."
                {
                    errors = "Invalid sale format missing \".\" - " + sale;
                }
                else
                {
                    String dollarS = sale.substring(1, sale.indexOf('.')); //Gets Dollar String
                    String centS = sale.substring(sale.indexOf('.') + 1, sale.length()); //Gets Cent String
                    try
                    {
                        dollars = Integer.parseInt(dollarS); //Checks if dollar value is not integer
                    }
                    catch (NumberFormatException ex)
                    {
                        errors = "Invalid dollar format - For input string: \"" +  dollarS + "\"";
                    }

                    try
                    {
                        cents = Integer.parseInt(centS); //Checks if cent value is not integer
                        if (cents >= 100)
                        {
                            errors += "Invalid cent format - For input string: \"" +  centS + "\"";
                        }
                    }
                    catch(NumberFormatException ex)
                    {
                        if ( errors != null)
                            errors += "\nInvalid cent format - For input string: \"" +  centS + "\"";
                        else
                            errors = "Invalid cent format - For input string: \"" +  centS + "\"";
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw ex; //Throws any unchecked exceptions
        }
    }

    public void printNumeric()
    {
        String output = String.format("$%d.", dollars);
        if(cents < 10)
        {
            output += String.format("%d0", cents);
        }
        else
        {
            output += String.format("%d", cents);
        }
        System.out.println(output);
    }

    public void printAlphabetic()
    {
        System.out.println(dollars + " dollars and " + cents + " cents");
    }

    public String getError()
    {
        return errors;
    }


}
I am trying to get the errors variable to print now.

I also need help getting the dollars and cents to print!

Thanks for the help!!

Jeff