Skip to content

консольное приложение №1 - #1

Open
Kazenosinobi wants to merge 2 commits into
mainfrom
dev
Open

Kazenosinobi wants to merge 2 commits into
mainfrom
dev

Conversation

@Kazenosinobi

Copy link
Copy Markdown
Owner

Сдача "консольное приложение №1" - попытка №1

Comment thread src/main/java/Input.java

public int input() {
System.out.println("На сколько человек разделить счёт?");
Scanner scanner = new Scanner(System.in);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Рекомендация: хорошей практикой является делать вызов scanner.close() после того, как сканнер больше не используется. Это необходимо для того, что бы этот объект не потреблял ресурсы, тогда когда это уже не требуется.

Comment thread src/main/java/RubEnding.java Outdated
int iscore = (int) score;
if (iscore >= 11 && iscore <= 14) {
return " рублей.";
} else if (iscore % 10 == 2 || iscore % 10 == 3 || iscore % 10 == 4) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • значение iscore % 10 считается несколько раз, стоит вынести в переменные
  • iscore >=2 && iscore <=4

Comment thread src/main/java/RubEnding.java Outdated
} else if (iscore % 10 == 2 || iscore % 10 == 3 || iscore % 10 == 4) {
return " рубля.";
} else if (iscore % 10 == 1) {
return " рубль.";

Copy link
Copy Markdown

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.

2 participants