Skip to content

Pull Request к практическому заданию - #8

Open
LeonidVonarab wants to merge 7 commits into
Yandex-Practicum:masterfrom
LeonidVonarab:master
Open

LeonidVonarab wants to merge 7 commits into
Yandex-Practicum:masterfrom
LeonidVonarab:master

Conversation

@LeonidVonarab

Copy link
Copy Markdown

No description provided.

Comment thread src/main/java/Calculate.java Outdated
this.sum = sum;
}

public static void calculate(String names, float sum, int number) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

тут нет необходимости использовать статику (ключевое слово static)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Так же тебе не надо передавать переменные класса в функцию, у тебя к ним и так есть доступ внутри функции.

Comment thread src/main/java/Calculate.java Outdated
Comment on lines +17 to +20
if (name.equalsIgnoreCase("Завершить")) {
System.out.println("Спасибо, что заглянули! Хорошего дня!");
} else {
while (!(name.equalsIgnoreCase("Завершить"))) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

если пользователь напишет "завершить на после ввода названия первого продукта, то ему не выведется прощальное сообщение "Спасибо, что заглянули..."

Comment thread src/main/java/Calculate.java Outdated
}

public static void conclude(int n, float s){
float l = n;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Здесь я полагаю происходит преобразование из типа int в float, это можно сделать проще, изменив следующую страну таким образом: float split = s/(float) n;

Comment thread src/main/java/Calculate.java Outdated
Comment on lines +52 to +53
String str = Integer.toString(a);
char lastLetter = str.charAt(str.length() - 1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

не обязательно преобразовывать число в строку, что бы получить последний символ, для это можно использовать различные виды деления, например целочисленное деление или деление с остатком

Comment thread src/main/java/Calculate.java Outdated
System.out.println(String.format("Вы набрали продуктов на сумму: %.2f%s", sum, rightRubles(sum)));
}

public static String rightRubles(float sum) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Так же здесь обработаны не все кейсы, например при сумме 111, будет не верное окончание

Comment thread src/main/java/Calculate.java Outdated
}
}

public static void conclude(int n, float s){

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

тут нет необходимости использовать статику (ключевое слово static)

Comment thread src/main/java/Calculate.java Outdated
System.out.println(String.format("Каждому надо заплатить по %.2f%s",split, rightRubles(split)));
}

public static void getResult(String names,float sum){

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

тут нет необходимости использовать статику (ключевое слово static)

Comment thread src/main/java/CountBuyers.java Outdated
this.number = number;
}

public static int countBuyers(int number) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

тут нет необходимости использовать статику (ключевое слово static)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Так же тебе не надо передавать переменные класса в функцию, у тебя к ним и так есть доступ внутри функции.

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