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
26 lines (23 loc) · 949 Bytes
/
Main.java
File metadata and controls
26 lines (23 loc) · 949 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
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int persons;
while (true) {
System.out.println("На скольких человек необходимо разделить счет?");
if (scanner.hasNextInt()) {
persons = scanner.nextInt();
if (persons > 1)
break;
else {
System.out.println("Ошибка:\n" + "Введенное значение должно быть больше 1-го!");
}
} else {
System.out.println("Ошибка:\n" + "Введенное значение должно быть целым числом!");
scanner.next();
}
}
Calculator calculator = new Calculator(persons);
calculator.start();
}
}