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

И пусть теперь все получиться!#1

Open
maxshef wants to merge 5 commits intomain from
dev
Open

И пусть теперь все получиться! #1
maxshef wants to merge 5 commits intomain from
dev

Conversation

@maxshef
Copy link
Owner

@maxshef maxshef commented May 13, 2023

Это мой первый Pull Request, надеюсь теперь получиться!

System.out.println("Сколько счетов у Вас будет?");
int howPeople = 0;
while (true){
howPeople = scanner.nextInt();
Copy link

@ilshat-abdulin ilshat-abdulin May 13, 2023

Choose a reason for hiding this comment

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

⚠ Нужно еще учесть, что пользователь может ввести строку и тогда приложение упадёт. Лучше такого не допускать, а обрабатывать. Можно использовать методы scanner.hasNextInt()/hasNextFloat() или try-catch

Comment on lines 21 to 22
String RUB;
String RUB2;
Copy link

@ilshat-abdulin ilshat-abdulin May 13, 2023

Choose a reason for hiding this comment

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

Comment on lines 25 to 57
if (endingRubles % 100 >= 11 && endingRubles % 100 <= 14) {
RUB = "рублей";
} else

switch (endingRubles %10){
case 1:
RUB = "рубль";
break;
case 2:
case 3:
case 4:
RUB = "рубля";
break;
default:
RUB = "рублей";
break;
}
if (endingRubles2 % 100 >= 11 && endingRubles2 % 100 <= 14) {
RUB2 = "рублей";
} else
switch (endingRubles2 % 10){
case 1:
RUB2 = "рублю";
break;
case 2:
case 3:
case 4:
RUB2 = "рубля";
break;
default:
RUB2 = "рублей";
break;
}
Copy link

@ilshat-abdulin ilshat-abdulin May 13, 2023

Choose a reason for hiding this comment

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

⚠ Здесь дублируется код из-за двух переменных. Лучше не допускать повторений кода. Для избежания этого, можно вычисление окончания слова "рубль", вынести в метод, который на вход может принимать числовое значение и возвращать вычисленную строку. Следовательно, можно этот метод переиспользовать там, где это необходимо.

String formatRub(double price) {
 ////
}

String product = scanner.next();
listProducts += product + "\n";
System.out.println("Введите цену товара в формате ХХ,ХХ");
double productPrice = scanner.nextDouble();
Copy link

@ilshat-abdulin ilshat-abdulin May 13, 2023

Choose a reason for hiding this comment

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

⚠ Здесь тоже есть необходимость добавить обработку некорректного ввода в виде строки

Comment on lines 14 to 18
if (productPrice <= 0) {
System.out.println("Введена неверная цена, цена должна быть больше 0.00");
}
if (productPrice > 0) {
}
Copy link

@ilshat-abdulin ilshat-abdulin May 13, 2023

Choose a reason for hiding this comment

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

⚠ Вне зависимости от того, что производится проверка ввода отрицательного числа, значение все равно будет сохранено в finalProductPrice

image

image

У тебя уже есть проверка, в которой можно сохранять положительные значения

if (productPrice > 0) {
}

@@ -1 +1,2 @@
# Пустой репозиторий для работы с Java кодом в Android Studio
И пусть все получиться! No newline at end of file
Copy link

@ilshat-abdulin ilshat-abdulin May 13, 2023

Choose a reason for hiding this comment

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

👍👍

Copy link
Owner Author

maxshef commented May 15, 2023

Добрый день, что-то в почте только смотрел, только увидел, что проверено еще 13 числа. Не очень понятно, все замечания надо исправить, или это для дальнейшего. Короче я не очень понимаю как понять принята работа или нет, где это можно увидеть?

Copy link

ilshat-abdulin commented May 16, 2023
edited
Loading

Добрый день, что-то в почте только смотрел, только увидел, что проверено еще 13 числа. Не очень понятно, все замечания надо исправить, или это для дальнейшего. Короче я не очень понимаю как понять принята работа или нет, где это можно увидеть?

Посмотреть статус проверки, наверное, можно на платформе, через которую ты отправлял ссылку. Если что, на этот счет, ты можешь уточнить у наставника или наставницы. Там же я оставил замечания, которые нужно исправить. А здесь я их продублировал и отметил ⚠. Замечания с 🍏 носят рекомендательный характер

Copy link
Owner Author

maxshef commented May 16, 2023

Спасибо, увидел где!

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

Reviewers

1 more reviewer

@ilshat-abdulin ilshat-abdulin ilshat-abdulin 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 によって変換されたページ (->オリジナル) /