Skip to content

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

Open
TelenkovAleksey wants to merge 6 commits intomainfrom
master
Open

Практическая работа №1#1
TelenkovAleksey wants to merge 6 commits intomainfrom
master

Conversation

@TelenkovAleksey
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown
Owner Author

@TelenkovAleksey TelenkovAleksey left a comment

Choose a reason for hiding this comment

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

Внес изменения

Copy link
Copy Markdown
Owner Author

@TelenkovAleksey TelenkovAleksey left a comment

Choose a reason for hiding this comment

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

Внес изменения.


} else {
System.out.println("Введите стоимость продукта в формате \"'рубли.копейки' [10.45, 11.40]\"");
float inputPrice = (float) scanner.nextDouble();

This comment was marked as resolved.


price = price + inputPrice;

System.out.println("Вы успешно добавили продукт:" + food + "\nИтог: " + String.format("%.2f", price) + " " + Matsh.floover(itog));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Здесь выводится стоимость товара - price, но расчет окончания слова Рубль берется для числа itog, а должна быть одна и та же переменная

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Наставница передала твой вопрос, что я имела в виду:
У тебя строка:
System.out.println("Вы успешно добавили продукт:" + food + "\nИтог: " + String.format("%.2f", price) + " " + Matsh.floover(itog));
А должно быть:
System.out.println("Вы успешно добавили продукт:" + food + "\nИтог: " + String.format("%.2f", price) + " " + Matsh.floover(price));
То есть просто ты тут выводишь число в виде переменной price, но в метод, выдающий окончание слова рубль передаешь другую переменную, itog. Из-за этого при выводе стоимости продукта окончание не то получалось

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