Skip to content

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

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

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

Conversation

@Dander33
Copy link
Copy Markdown

@Dander33 Dander33 commented Nov 8, 2022

No description provided.

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

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants