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...