Skip to content

Conversation

@ZimikXXIV
Copy link
Owner

No description provided.

double result = account/countPeople;
int preResult = (int)Math.floor(account/countPeople); //switch не работает c double....

switch (preResult%10){

Choose a reason for hiding this comment

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

Студия сама подсвечивает, что код можно улучшить. Поставь курсов на switch, слева появится желтый фонарик. нажми на него - и он предложит улучшение. Вот как это
image
превращается в это
image

// главная функция, получает кол-во людей, запрашивает товары, и выводит итог
public void getGoods(){

scanner = new Scanner(System.in);

Choose a reason for hiding this comment

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

Тут не нужно создавать новый сканер, ведь 1 у тебя уже есть

}
}
}

Choose a reason for hiding this comment

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

Совет: можно автоматически подогнать стилистику кода под стандарты языка, для этого нужно в меню выбрать code - reformat code. Он автоматом выставит все отступы и пробелы

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