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#104

Open
Fandorina wants to merge 3 commits intoYandex-Practicum:master from
Fandorina:master
Open

Проектная работа 1 #104
Fandorina wants to merge 3 commits intoYandex-Practicum:master from
Fandorina:master

Conversation

@Fandorina
Copy link

@Fandorina Fandorina commented Oct 29, 2022

Жаль, не было времени полностью вникнуть в задачу, зато сделала сама и без помощи. Строго не судите, пожалуйста, я правда старалась. Очень жду критику и предложения, как улучшить код. Спасибо!

Comment on lines 68 to 75
switch (lastNum) {
case 1:
rubles = "рубль";
case 2 | 3 | 4:
rubles = "рубля";
default:
rubles = "рублей";
}
Copy link

Choose a reason for hiding this comment

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

в случае если totalPrice будет = 11, выведется не верное окончание

Comment on lines 41 to 62
while (true) {
System.out.println("Введите название товара или введите команду \"Завершить\".");
String productName = scanner.next();
if (productName.equalsIgnoreCase("finish")) {
System.out.println("Добавленные товары: " + "\n" + allProducts);
break;
} else {
allProducts = allProducts + productName + "\n";
while (true) {
System.out.println("Введите стоимость товара в формате \"рубли,копейки\".");
productPrice = scanner.nextDouble();
if (productPrice <= 0) {
System.out.println("Некорректное значение.");
} else {
break;
}
}
totalPrice = totalPrice + productPrice;
System.out.println("Товар добавлен в чек.");
}

}
Copy link

Choose a reason for hiding this comment

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

В случае если ввести не число, то приложение упадет, этого можно избежать с помощью конструкции try catch

Copy link
Author

Добавлен отлов ошибок и проверка на цифры

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

Reviewers

1 more reviewer

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