forked from Yandex-Practicum/Java-Module-Project-YP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
38 lines (28 loc) · 1.24 KB
/
Main.java
File metadata and controls
38 lines (28 loc) · 1.24 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
30
31
32
33
34
35
36
37
38
// dev branch for Y.Practicum
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("На скольких человек поделить счёт?");
while (true) {
if (!scanner.hasNextInt()) {
System.out.println("Ошибка, введён текст\nВведите числовое значение");
scanner.nextLine();
} else {
int people = scanner.nextInt();
if (people == 1) {
System.out.println("Зачем тебе делить свою еду?\nВведите другое количество");
}
if (people < 1) {
System.out.println("А положительных друзей у тебя нет?\nВведите положительное число");
}
if (people > 1) {
System.out.println("Давай считать");
GroceryList groceryList = new GroceryList();
groceryList.product(people);
break;
}
}
}
}
}