forked from Yandex-Practicum/Java-Module-Project-YP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPeople.java
More file actions
27 lines (25 loc) · 888 Bytes
/
People.java
File metadata and controls
27 lines (25 loc) · 888 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
import java.util.Scanner;
public class People {
Scanner scanner = new Scanner(System.in);
int personCheck;
public void person() {
System.out.println("Введите количество на сколько человек необходимо разделить счёт");
while (true){
if (!scanner.hasNextInt()) {
System.out.println("Введите целое число, а не "+scanner.nextLine());
} else {
personCheck= scanner.nextInt();
break;
}
}
}
public void morePerson() {
while (personCheck <= 1) {
System.out.println("Некорректное значение, введите число больше 1");
person();
if (personCheck > 1){
break;
}
}
}
}