Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Спринт 2 Калькулятор#121

Closed
Dander33 wants to merge 1 commit intoYandex-Practicum:master from
Dander33:master
Closed

Спринт 2 Калькулятор #121
Dander33 wants to merge 1 commit intoYandex-Practicum:master from
Dander33:master

Conversation

@Dander33
Copy link

@Dander33 Dander33 commented Nov 8, 2022

No description provided.

int persons;
double foodCost;
double totalCost;
double costPerPerson;
Copy link

@MagicUnderHood MagicUnderHood Nov 9, 2022

Choose a reason for hiding this comment

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

Переменная не используется, можно удалить



double foodCostCalc (int persons, double foodCost) {
this.persons = persons;
Copy link

@MagicUnderHood MagicUnderHood Nov 9, 2022

Choose a reason for hiding this comment

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

Кажется, переменная не используется, только инициализируется


String currencyAddition(double num){
double adds = num % 100;
int addsInvert = (int) (Math.floor(adds));
Copy link

@MagicUnderHood MagicUnderHood Nov 9, 2022

Choose a reason for hiding this comment

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

Лучше сначала округлить, а потом взять остаток от деления по модулю 100
Стоит добавить if с проверкой, что addsInvert >= 11 и <=19, тогда возвращать рублей

double adds = num % 100;
int addsInvert = (int) (Math.floor(adds));

switch (addsInvert){
Copy link

@MagicUnderHood MagicUnderHood Nov 9, 2022

Choose a reason for hiding this comment

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

А здесь добавить деление по модулю 10, чтобы брать последнюю цифру

persons = input.nextInt();
if (persons <= 0) {System.out.println("Количество участников отрицательно или равно нулю. Попробуйте еще раз.");}
else if (persons == 1) {System.out.println("Нет необходимости делить счет");}
else if (persons >0) {break;}
Copy link

@MagicUnderHood MagicUnderHood Nov 9, 2022

Choose a reason for hiding this comment

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

Можно здесь поставить просто else, потому что с предыдущими проверками тут members >0 будет всегда true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@MagicUnderHood MagicUnderHood MagicUnderHood left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Comments

AltStyle によって変換されたページ (->オリジナル) /