Skip to content

Conversation

@Wildmeats
Copy link
Owner

No description provided.

import java.util.ArrayList;
import java.util.Scanner;


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Импорты от класса принято разделять 1 пустой строкой

}

private void inputNumberOfPeople() {
Scanner scanner = new Scanner(System.in);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше вынести сканер на уровень класса и его использовать везде, а не создавать в каждом методе новый

while (true) {
System.out.println("Введите название товара и его стоимость в формате 'название стоимость': например, пиво 58.99\nЛибо введите команду 'Завершить' для того, чтобы завершить процесс добавления товаров.");
String line = scanner.nextLine().trim();
if (line.equalsIgnoreCase("завершить")) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Стоп-слово завершить можно вынести на уровень класса, чтобы если вдруг его пришлось менять - тебе не придется бегать по коду и искать его во всех файлах

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants