Task:

Based on what you learned in Quiz 10.7, fix compareTo() inside the Product class.

Test:

The prices in this array vary by a few cents. Use it to test your code.

        Product[] products = new Product[] {
            new Pants(32, 24.59, "Blue", "JAVA KLEIN"),
            new Shirt(Shirt.Size.MEDIUM, 24.29, "Black", "CHANEL"),
            new Pants(34, 24.53, "Red", "JANGLER"),
            new Shirt(Shirt.Size.SMALL, 24.89, "Orange", "GEORGE"),
            new Pants(30, 24.54, "Grey", "FENDI"),
            new Shirt(Shirt.Size.LARGE, 24.49, "Blue", "ECKO"),
            new Pants(30, 24.51, "Red", "VERSACE"),
            new Shirt(Shirt.Size.SMALL, 24.49, "Beige", "ZARA"),
            new Pants(29, 24.53, "Dark", "JANGLER"),
            new Shirt(Shirt.Size.SMALL, 24.79, "Red", "NIKE"),
            new Pants(26, 24.58, "Indigo", "BELSTAFF"),
            new Shirt(Shirt.Size.LARGE, 24.54, "Blue", "ADIDAS"),
            new Pants(34, 24.50, "Red", "JANGLER"),
        };

Expected Result:

Your array should sort from lowest to highest price.