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

Add sum distribute#1

Open
desska wants to merge 2 commits intodev from
develop
Open

Add sum distribute #1
desska wants to merge 2 commits intodev from
develop

Conversation

@desska
Copy link
Owner

@desska desska commented Aug 24, 2023

Домашняя работа по распределению счета


}

private ArrayList<Item> items;
Copy link

@ArturNurtdinov ArturNurtdinov Aug 24, 2023

Choose a reason for hiding this comment

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

Переменные класса должны объявляться перед конструкторами (см. Java Code Conventions https://www.oracle.com/technetwork/java/codeconventions-150003.pdf пункт 3.1.3)

break;
}

return "руб" + ending;
Copy link

@ArturNurtdinov ArturNurtdinov Aug 24, 2023

Choose a reason for hiding this comment

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

Можно отказаться от переменной ending и делать return внутри веток конструкции switch:

case('1'):
 return "рубль";

String itemName = input.next(scanner);

System.out.println("Введите цену для товара " + itemName);
double itemPrice = input.nextDouble(scanner);
Copy link

@ArturNurtdinov ArturNurtdinov Aug 24, 2023

Choose a reason for hiding this comment

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

нужно проверить, что itemPrice больше 0, в противном случае - запрашивать повторный ввод

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

Reviewers

1 more reviewer

@ArturNurtdinov ArturNurtdinov ArturNurtdinov 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 によって変換されたページ (->オリジナル) /