Skip to content

ПЗ 1 - #1

Open
NikAndreev333 wants to merge 2 commits into
mainfrom
dev
Open

NikAndreev333 wants to merge 2 commits into
mainfrom
dev

Conversation

@NikAndreev333

Copy link
Copy Markdown
Owner

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

NikAndreev333 added 2 commits August 1, 2023 21:38
String productList = "Добавленные товары:";


void priceForPerson() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Имена функций должны содержать в себе действие. Функция делает что-либо. Хорошо помогает практика переводить имена функций дословно, если после перевода понятно чем занимается функция, то название хорошее

String rub ="";
public void formatRub(double price) {
int form = (int) Math.floor(price);
if (form % 100 >= 11 && form % 100 <= 14) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Здесь гораздо лучше подойдет оператор switch/case, так как количество веток if-else больше 2

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