Write a class Product (name, category, price, stock; toString formatted %-10s %-8s %8.2f stock %d) and a public class ProductCatalog.
main reads n, then n products (name category price stock), then a name to search for and a category. It then:
- sorts the array by price with your own selection sort
sortByPrice(Product[] items)(swap the references); - prints the sorted list, the stock value (Σ price × stock), the number of products in stock in the category, and the result of
findByName(ignore case;Found: …or… : not found).
Stock value: 6620.00
In stock in office: 3
Found: Lamp home 89.00 stock 0