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

Comments

Не бейте сильно пишу первый раз в жизни :(#1

Open
nim0y wants to merge 3 commits intomain from
dev
Open

Не бейте сильно пишу первый раз в жизни :( #1
nim0y wants to merge 3 commits intomain from
dev

Conversation

@nim0y
Copy link
Owner

@nim0y nim0y commented Apr 18, 2023
edited
Loading

4 дня ужаса
безнадеги
5-6 удалений всего и вся
и этот "монстр франкенштейна" ~ "готов".
Сдаюсь.
С богом.)))
Забыл в FormRub сделать 2ой метод на склонение слова Рубль.


public void finCountDown(int guestNumber) {
System.out.println("Добавлено:\n" + productNameC);
/*System.out.println(String.format(productNameC,System.lineSeparator()));*///хз нашел в интернетах,не разобрался
Copy link

@AleksandrIlinskii AleksandrIlinskii Apr 19, 2023

Choose a reason for hiding this comment

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

Если есть вопросы - всегда можно спросить у куратора.
Но комментарии лучше не пушить

nim0y reacted with thumbs up emoji
Copy link
Owner Author

Choose a reason for hiding this comment

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

Это для себя было , на случай если где то поломается.Спасибо!

if ((int)(Calc.finalCost % 100 / 10) == 1){
return " рублей.";
}
switch ((int) (Calc.finalCost % 10)){
Copy link

@AleksandrIlinskii AleksandrIlinskii Apr 19, 2023

Choose a reason for hiding this comment

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

Совет на будущее: Если поставить курсор на switch, то можно увидеть фонарик желтый. Он подскажет улучшения кода

Copy link
Owner Author

Choose a reason for hiding this comment

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

Тут два момента :

  1. Хотелось\показалось что Swich тут подходит.
  2. при изменении выдает ошибки которые я не совсем понимаю как править.
    изображение_2023年04月19日_080705750





Copy link

@AleksandrIlinskii AleksandrIlinskii Apr 19, 2023

Choose a reason for hiding this comment

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

Слишком много пустых строк, лучше не стоит так делать

Copy link
Owner Author

Choose a reason for hiding this comment

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

Принято убираю , в будущем постараюсь не оставлять.

@@ -0,0 +1,30 @@
import java.util.Scanner;

public class Gests {
Copy link

@AleksandrIlinskii AleksandrIlinskii Apr 19, 2023

Choose a reason for hiding this comment

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

Если предполагалось, что название класса переводится как "Гость", то тут опечатка

Copy link
Owner Author

Choose a reason for hiding this comment

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

Да нет , я пока писал неслолько раз создавал похожие классы.
Крутил разные куски кода , в итоге что бы не путаться в блокноте получилось так.
Понимаю, буду внимательнее.


public class Gests {
public static int guestNumber;
public static int Gest() {
Copy link

@AleksandrIlinskii AleksandrIlinskii Apr 19, 2023

Choose a reason for hiding this comment

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

И тут опечатка (см коммент выше)


public class Gests {
public static int guestNumber;
public static int Gest() {
Copy link

@AleksandrIlinskii AleksandrIlinskii Apr 19, 2023

Choose a reason for hiding this comment

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

Зачем делать возвращаемый тип у метода int, если ты его не используешь? Для таких целей есть void
image





Copy link

@AleksandrIlinskii AleksandrIlinskii Apr 19, 2023

Choose a reason for hiding this comment

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

Тут тоже многовато строк

@@ -0,0 +1,24 @@
public class Calc {
String productNameC = "";
Copy link

@AleksandrIlinskii AleksandrIlinskii Apr 19, 2023

Choose a reason for hiding this comment

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

Названия productName вполне достаточно для понимания зачем оно нужно

case 4:
return " рубля.";
default:
return " рублей.";
Copy link

@AleksandrIlinskii AleksandrIlinskii Apr 19, 2023

Choose a reason for hiding this comment

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

Критическое замечание
Неверно выводится окончание слова рубль
image

nim0y added 2 commits April 19, 2023 08:33
... "лампочки" (больше желтым не подсвечивает).
Незнаю можно ли делать commit после отправки ссылки на Практикум. Риск дело благородное.))
}
if ((int) (Calc.finalCost % 10) == 1) {
return " рубль.";
} else if ((int) (Calc.finalCost % 10) == 2 || (int) (Calc.finalCost % 10) == 3 || (int) (Calc.finalCost % 10) == 4) {
Copy link

@AleksandrIlinskii AleksandrIlinskii Apr 19, 2023

Choose a reason for hiding this comment

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

Как совет, ты можешь парой строчек выше завести переменную типа
int lastDigit = (int) (Calc.finalCost % 10) и ее подставлять во все проверки твоих условий, а то сейчас получается, что ты считаешь одно и то же 4 раза.
Это называется boilerplate code (код, который повторяется в нескольких местах). Очень легко так ошибиться

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

Reviewers

1 more reviewer

@AleksandrIlinskii AleksandrIlinskii AleksandrIlinskii 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.

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