(List<? extends Trash> bin, String type)
| 9 | public class TrashValue { |
| 10 | private static double total; |
| 11 | public static void |
| 12 | sum(List<? extends Trash> bin, String type) { |
| 13 | total = 0.0; |
| 14 | bin.forEach( t -> { |
| 15 | System.out.println(t); |
| 16 | total += t.weight * t.price(); |
| 17 | }); |
| 18 | System.out.printf( |
| 19 | "Total %s value = %.2f%n", type, total); |
| 20 | } |
| 21 | } |