public class HelloWorld{ public static void main(String []args){ System.out.println("Hello World"); Product p1 = new Product(1, 50 , 9999); Product p2 = new Product(2 , 990); Product p3 = new Product(3 , 40 , 1); System.out.println(p1); System.out.println(p2.toString()); System.out.println(p3.toString()); p3.sell(50); p1.sell(50); } } class Product{ private int ID; private int price; private int stock; public Product(int ID, int price, int stock) { this.ID = ID ; this.price = price; this.stock = stock; } public Product(int ID, int price) { this.ID = ID ; this.price = price ; stock = 0; } public String toString () { return "This Products's ID is " + ID + ", Price is " + price + " , Stock is " + stock; } public void sell (int a) { if (stock >= a) { System.out.println(a * price); } else { System.out.println("Insufficient Stock"); } stock = stock - a; } }