MainApplication.java 670B

123456789101112131415161718192021
  1. import java.util.ArrayList;
  2. public class MainApplication {
  3. public static void main(String[] args){
  4. Product apple = new Product("apple", 1000, 3.50, 15);
  5. Product eggs = new Product("eggs", 1001, 2.00, 18);
  6. Product bread = new Product("bread", 1002, 2.50, 25);
  7. Product rice = new Product("rice", 1003, 2.00, 15);
  8. Inventory inventory = new Inventory();
  9. inventory.add(apple);
  10. inventory.add(eggs);
  11. inventory.add(bread);
  12. inventory.add(rice);
  13. System.out.print(inventory.getAllProductInfo());
  14. System.out.print("Total inventory value: "+ inventory.getTotalInventoryValue());
  15. }
  16. }