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> {
}
The program output might look something like this (using the PromotionManager class):
The promotions have been added:
The promotions have been added:
100, Big sale, 10.00
100, Big sale, 10.00
101, Sampling, 15.00
101, Sampling, 15.00
102, Flash Sale, 20.00
102, Flash Sale, 20.00
103, Refund, 25.00
103, Refund, 25.00
104, Loyal, 30.50
104, Loyal, 30.50
Add a new promotion:
Add a new promotion:
Enter id:106
Enter id:106
Enter name:Opening
Enter name:Opening
Enter discount percentage:9.9
Enter discount percentage:40
1.Test getMinDiscountPercentage
1.Test getMinDiscountPercentage
Close
+ 93%