-
Notifications
You must be signed in to change notification settings - Fork 205
Expand file tree
/
Copy pathTask02Main.java
More file actions
29 lines (25 loc) · 1.06 KB
/
Task02Main.java
File metadata and controls
29 lines (25 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.example.task02;
public class Task02Main {
private static final Item ITEM1 = new Item("Товар 1", 10);
private static final Item ITEM2 = new Item("Товар 2", 20);
private static final Item ITEM3 = new Item("Товар 3", 30);
private static final Item ITEM4 = new Item("Товар 4", 40);
private static final Item ITEM5 = new Item("Товар 5", 50);
private static final Item ITEM6 = new Item("Товар 6", 60);
public static void main(String[] args) {
Bill bill = new Bill();
bill.add(ITEM1, 10);
bill.add(ITEM3, 3);
bill.add(ITEM6, 1);
System.out.println(bill);
bill.add(ITEM3, 3);
System.out.println(bill);
DiscountBill discountBill = new DiscountBill(10);
discountBill.add(ITEM1,10);
discountBill.add(ITEM3, 3);
discountBill.add(ITEM6,1);
System.out.println(discountBill);
System.out.println("Скидки: " + discountBill.getDiscount());
System.out.println("Выгода: " + discountBill.getBenefit());
}
}