-
Notifications
You must be signed in to change notification settings - Fork 205
Expand file tree
/
Copy pathTask02Main.java
More file actions
24 lines (21 loc) · 1.03 KB
/
Task02Main.java
File metadata and controls
24 lines (21 loc) · 1.03 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
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);
public static void main(String[] args) {
Bill bill = new Bill();
bill.add(ITEM1, 10);
bill.add(ITEM2, 5);
bill.add(ITEM3, 2);
System.out.println("Базовый счет:\n\n" + bill);
DiscountBill discountBill = new DiscountBill(10);
discountBill.add(ITEM1, 10);
discountBill.add(ITEM2, 5);
discountBill.add(ITEM3, 2);
System.out.println("\nСчет со скидкой:\n" + discountBill);
System.out.println("\nРазмер скидки: " + discountBill.getDiscount() + "%");
System.out.println("Абсолютное значение скидки: " + discountBill.getDiscountAmount());
System.out.println("Итоговая стоимость: " + discountBill.getPrice());
}
}