Skip to content

Conversation

@ilyaPetr
Copy link
Owner

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

calculator.totalOutput(numberOfFriends);
}
}
class Calculator //получает на вход название и цену товара, сохраняет названия и общую сумму товаров, выводит в нужном формате

Choose a reason for hiding this comment

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

Классы лучше вынести в отдельные файлы

while (true) {
System.out.println( "Введите название товара!"); //название может быть любым в том числе и числовым
foodName = scanner.next();
calculator.AddTovarName(foodName);

Choose a reason for hiding this comment

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

Методы по код стайлу нужно называть в camelCase


System.out.println(tovarName + "\n"); //выводим список всех товаров

System.out.println("Общая сумма к оплате: " + String.format("%.2f", totalPrice) + rubFormat(Math.floor(totalPrice)));

Choose a reason for hiding this comment

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

На самом деле Math.floor не обязательно, потому что приведение double к int точно также сделает округление

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.

3 participants