forked from Yandex-Practicum/Java-Module-Project-YP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculator.java
More file actions
34 lines (26 loc) · 748 Bytes
/
Calculator.java
File metadata and controls
34 lines (26 loc) · 748 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
29
30
31
32
33
34
import java.util.ArrayList;
import java.util.List;
public class Calculator {
static List<Product> products = new ArrayList<>();
static double calculator = 0.0;
static int people = -1;
public static void addProduct (Product product) {
products.add(product);
calculator += product.getPrice();
}
public static int getProductsSize () {
return products.size();
}
public static int getPeople () {
return people;
}
public static void setPeople (int p) {
people = p;
}
public static String getProductInfo (int i) {
return products.get(i).toString();
}
public static double getCheckGuest () {
return calculator / (double)people;
}
}