-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
28 lines (21 loc) · 934 Bytes
/
Main.java
File metadata and controls
28 lines (21 loc) · 934 Bytes
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
public class Main {
public static void main(String[] args) {
Product laptop = new Product("Ноутбук", 75000.0);
Product mouse = new Product("Мышка", 1500.0);
Product keyboard = new Product("Клавиатура", 3000.0);
Product headphones = new Product("Наушники", 5000.0);
Cart cart = new Cart();
cart.addProduct(laptop);
cart.addProduct(mouse);
cart.addProduct(keyboard);
cart.addProduct(headphones);
cart.printCart();
System.out.println("Удаляем: Мышка\n");
cart.removeProduct("Мышка");
cart.printCart();
System.out.println("Удаляем несуществующий товар: Планшет");
boolean removed = cart.removeProduct("Планшет");
System.out.println("Товар удален: " + removed + "\n");
cart.printCart();
}
}