Skip to content

Homework 6#8

Open
MaximShatrov wants to merge 61 commits intomasterfrom
Homework_6
Open

Homework 6#8
MaximShatrov wants to merge 61 commits intomasterfrom
Homework_6

Conversation

@MaximShatrov
Copy link
Copy Markdown
Owner

Коллекции в Java

dmitrypokrasov and others added 28 commits September 16, 2020 17:58
Имплементация интерфейса ITerminal в классе Service и реализация методов согласно контракту:
1. Проверки состояния счета
2. Снятия/внесения денег
3. Создание/удаление клиента
src/Console.java Outdated
"\n8.Выход" +
"\n\nВаш выбор:");
int menuSelect = console.scanData.inputInt(console.scanner);
if (menuSelect == console.MENU_ADD_PLAYER) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

так это чо епта!?
https://javarush.ru/groups/posts/operator-switch-v-java
шоб я такого больше не видел

Copy link
Copy Markdown
Owner Author

@MaximShatrov MaximShatrov Oct 30, 2020

Choose a reason for hiding this comment

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

Сделал switch
Константы выбора пришлось определить в методе, т.к. через console.MENU_* он их не воспринимает как константу

src/Console.java Outdated
while (true) {
System.out.println("Введите рейтинг игрока (0...100):");
int ratio = scanData.inputInt(scanner);
if (ratio <= 100 && ratio >= 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

константы

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

ок

}

private int selectRating() {
while (true) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

фигаси вечные циклы у тебя тута) Но я понял, ретурн его кончит)

src/Console.java Outdated
while (true) {
System.out.println("На сколько поднять рейтин игрока? (0...100):");
int ratio = scanData.inputInt(scanner);
if (ratio <= 100 && ratio >= 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

константинополи

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

ок

src/Console.java Outdated
private League selectLeague() {
while (true) {
System.out.println("Выберите футбольную лигу игрока:");
int i = 1;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ай шайтан труба константу плез

Copy link
Copy Markdown
Owner Author

@MaximShatrov MaximShatrov Oct 30, 2020

Choose a reason for hiding this comment

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

Какую? куда? зачем?
i это ж тупа счетчик для печати в foreach
Ну обозвал его counter чтобы понятнее было

src/Console.java Outdated
System.out.println("Ваш выбор: ");
int menuSelect = scanData.inputInt(scanner);
if (menuSelect <= League.values().length) {
return League.values()[menuSelect - 1];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ыыыыы

src/Console.java Outdated
private Country selectCountry() {
while (true) {
System.out.println("Выберите страну игрока:");
int i = 1;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ну ета не серьезно

src/Console.java Outdated
System.out.println("Ваш выбор: ");
int menuSelect = scanData.inputInt(scanner);
if (menuSelect <= Country.values().length) {
return Country.values()[menuSelect - 1];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ну япона мать

} else {
System.out.println("Неправильный выбор!");
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

а объединить 2 метода selectCountry и selectLeague никак не получится? Вроде на первый взгляд код абсолютно одинаковый, отличаются ток текстовки и список лиг\стран

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Объединил, но другие комментарии к этому методу не понял

@Override
public String toString() {
return "\n" + nickName + ": рейтинг - " + ratingPoints + ", страна - " + country + ", лига - " + league;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

toString hashCode equals обычно в самый низ убирают

Copy link
Copy Markdown
Owner Author

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