Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

Практическая работа No1#1

Open
Venser724 wants to merge 7 commits intomain from
dev
Open

Практическая работа No1 #1
Venser724 wants to merge 7 commits intomain from
dev

Conversation

@Venser724
Copy link
Owner

@Venser724 Venser724 commented May 13, 2024

No description provided.

@@ -0,0 +1,29 @@
import java.util.ArrayList;

public class Formatter {
Copy link

Choose a reason for hiding this comment

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

Здорово, что форматтер вынесен в отдельный класс!

Comment on lines 5 to 7
private final static String GREET = "На сколько человек требуется разделить счёт?";
private final static String ERRORINCORRECTNUMBER = "Введено некорректное число. \nВведите корректное число.";
private final static String ADDNEWGOOD = "Добавление товара. Ведите наименование товара или 'Завершить' для перехода к расчёту чека";
Copy link

Choose a reason for hiding this comment

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

Ты вынес текст в константы -- это хорошо. Но кодстайл говорит, что названия констант должны быть написаны в UPPER_SNAKE_CASE



System.out.println(ADDNEWGOOD);
String name = scanner.nextLine();
Copy link

Choose a reason for hiding this comment

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

Здесь есть небольшое повторение. Мы выводим строку перед циклом и в конце цикла. Можно использовать цикл do-while, чтобы этого избежать(Но это совсем не обязательно!).

return true;
}

static int inputNumber(Scanner scanner) {
Copy link

Choose a reason for hiding this comment

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

Мне нравится, что логика вынесена в отдельные функции, но кажется, что можно было сделать проще используюя стандартные методы сканера.

Comment on lines +43 to +44
if (!Character.isDigit(string.charAt(i))) {
if (!Character.isDigit(string.charAt(i))) {
Copy link

Choose a reason for hiding this comment

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

Зачем тут два раза одинаковая проверка?

System.out.println(GREET);
int number = 1;
Scanner scanner = new Scanner(System.in);
//int number = inputNumber(scanner);
Copy link

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

Reviewers

1 more reviewer

@kekulta kekulta kekulta left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /