15. Processing Data with Streams
Activity 1: Applying Discount on the Items
Solution
Activity1.java
30 double sum = calculatePrice(fruitCart, vegetableCart, meatAndFishCart); 31 System.out.println(String.format("Sum: %.2f", sum)); 32 33 Map<String, Double> discounts = Map.of("Cod", 0.2, "Salad", 0.5); 34 35 double sumDiscount = calculatePriceWithDiscounts(discounts, fruitCart, vegetableCart, meatAndFishCart); 36 System.out.println(String.format("Discount sum: %.2f", sumDiscount)); 37 } 38 39 private static double calculatePrice(ShoppingCart... carts...