-
Notifications
You must be signed in to change notification settings - Fork 222
Пулл реквест ПР #1 #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| // вы не должны ограничиваться только классом Main и можете создавать свои классы по необходимости | ||
| System.out.println("Привет Мир"); | ||
| System.out.println("Делитель счёта v.100500. Привет!"); | ||
| Calculate cal = new Calculate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно сделать метод и переменные Calculate static, чтобы не приходилось создавать экземпляр класса и можно было просто вызывать методы класса напрямую
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не получилось. Не совсем понял.
src/main/java/Main.java
Outdated
|
|
||
| } | ||
| } | ||
| public static class Calculate{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше вынести класс отдельно, а не делать вложенным классом, так как сказывается на читаемости кода.
src/main/java/Main.java
Outdated
| persons= sc.nextInt(); | ||
| if (persons<=1){ | ||
| System.out.println("Людей не может быть меньше двух! Попробуйте ещё раз!"); | ||
| continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continue здесь не нужен, так как он необходим для завершения итерации цикла и начале новой итерации. Здесь continue последняя команда цикла, то есть итерация и без него закончится
src/main/java/Main.java
Outdated
| if (getMore.equalsIgnoreCase("нет")) { | ||
| break; | ||
| }else{ | ||
| continue;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continue также не нужен
src/main/java/Main.java
Outdated
| public void payPeople(){ | ||
|
|
||
| System.out.println("Добавленные товары: \n"+items); | ||
| double payPerPerson=total/persons; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
неиспользуемая переменная
src/main/java/Main.java
Outdated
| } | ||
| System.out.println(endRuble); // это шок | ||
| //Я не понимаю как иначе вывести переменную endRuble. Её нельзя добавить в верхний метод. | ||
| } //Если поменять параметры метода, то потом он просто не встанет в Main. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно и не вызывать в main, а вызывать в payPeople(). Это же служебный метод, обслуживающий payPeople - так что строго говоря к Main он не имеет особого отдельного отношения
No description provided.