Skip to content

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

Open
ilyaPetr wants to merge 2 commits intomainfrom
dev
Open

Практическая работа 1#1
ilyaPetr wants to merge 2 commits intomainfrom
dev

Conversation

@ilyaPetr
Copy link
Copy Markdown
Owner

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

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

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);
Copy link
Copy Markdown

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)));
Copy link
Copy Markdown

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.

2 participants