Skip to content

Added initial functionality - #1

Open
GazarovaPolina wants to merge 1 commit into
masterfrom
feature/initial-functionality
Open

GazarovaPolina wants to merge 1 commit into
masterfrom
feature/initial-functionality

Conversation

@GazarovaPolina

Copy link
Copy Markdown
Owner

No description provided.


while (true) {

System.out.println("Введите любой символ для продолжения добавления товаров или \"завершить\":");

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("Введите название товара:");
productName = scanner.nextLine();

System.out.println("Введите его стоимость:");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Можно дописать формат, в котором ожидается стоимость

if (productPrice <= 0) {
return false;
}
return true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Студия подсказывает, что вместе с if-ом выше можно преобразовать в код: return !(productPrice <= 0);

payment += product.getPrice();
}
payment /= friendsAmount;
int lastDigit = (int) Math.floor(payment) % 10;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Единственное, не учтено для чисел 11-19, окончание должно быть "рублей", а сейчас дает рубля для 12-14. Для этого стоит проверять, что (int) Math.floor(payment) % 100 между 11 и 19 включительно находится

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