id, name, and discount percentage. The discount percentage is formatted to two decimal places
Write a class Promotion Manager which extends from ArrayList (ArrayList is a collection) with the following information:
Promotion Manager
+addPromotion(promotion: Promotion):void +getMinDiscountPercentage(): double
Where:
addPromotion(promotion: Promotion): void-add a new promotion to the collection
5 of 6 Paper No: 1
+sumDiscountPercentageByValue(value:double): double
getMinDiscount Percentage(): double - return the smallest discount percentage among all promotions.
sumDiscountPercentageByValue(value:double ): double - return the sum of discount percentage of promotions that have discount percentage greater or equal to value. If no matching data is found, return 0
Hints: to declare the PromotionManager class, you can use the following statement:public class Promotion Manager extends ArrayList<Promotion> {
+ 93%
Close