Skip to content

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

Open
maxshef wants to merge 5 commits into
mainfrom
dev
Open

maxshef wants to merge 5 commits into
mainfrom
dev

Conversation

@maxshef

@maxshef maxshef commented May 13, 2023

Copy link
Copy Markdown
Owner

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

Comment thread src/main/java/Main.java Outdated
System.out.println("Сколько счетов у Вас будет?");
int howPeople = 0;
while (true){
howPeople = scanner.nextInt();

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.hasNextInt()/hasNextFloat() или try-catch

Comment thread src/main/java/Main.java Outdated
Comment on lines +21 to +22
String RUB;
String RUB2;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread src/main/java/Main.java Outdated
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
Copy Markdown

Choose a reason for hiding this comment

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

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

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

Comment thread src/main/java/ProductFeatures.java Outdated
String product = scanner.next();
listProducts += product + "\n";
System.out.println("Введите цену товара в формате ХХ,ХХ");
double productPrice = scanner.nextDouble();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

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

Copy link
Copy Markdown

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) {

}

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍👍

@maxshef

maxshef commented May 15, 2023

Copy link
Copy Markdown
Owner Author

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

@ilshat-abdulin

ilshat-abdulin commented May 16, 2023 •

Copy link
Copy Markdown

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

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

@maxshef

maxshef commented May 16, 2023

Copy link
Copy Markdown
Owner Author

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

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