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

Проектная работа No1#1

Open
Vasil9202 wants to merge 5 commits intomain from
master
Open

Проектная работа No1 #1
Vasil9202 wants to merge 5 commits intomain from
master

Conversation

@Vasil9202
Copy link
Owner

@Vasil9202 Vasil9202 commented Nov 22, 2022

No description provided.


double result = calculator.divideSum();
Formatter formatter = new Formatter();
Calculator calculator = new Calculator();
Copy link

@MagicUnderHood MagicUnderHood Nov 23, 2022

Choose a reason for hiding this comment

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

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


String cart = "Добавленные товары:";
double totalPrice = 0;
private int humanCount;
Copy link

@MagicUnderHood MagicUnderHood Nov 23, 2022

Choose a reason for hiding this comment

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

Студия подсказывает, что переменную можно перенести в конструктор, где она инициализируется, быть полем класса ей не обязательно

double totalPrice = 0;
private int humanCount;
private static final Scanner scanner = new Scanner(System.in);
private List<Product> productsList;
Copy link

@MagicUnderHood MagicUnderHood Nov 23, 2022

Choose a reason for hiding this comment

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

Переменная инициализируется, но не используется

while (true){
try{
System.out.println("На скольких человек необходимо разделить счёт?");
int count = Integer.parseInt(scanner.nextLine());
Copy link

@MagicUnderHood MagicUnderHood Nov 23, 2022

Choose a reason for hiding this comment

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

Можешь применить в студии автоформатирование (в выбранном файле, сверху вкладка Code - Reformat Code, либо Ctrl+Alt+L), тогда автоматически код выправится

case "7":
case "8":
case "9":
return "рублей";
Copy link

@MagicUnderHood MagicUnderHood Nov 23, 2022

Choose a reason for hiding this comment

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

Можно все эти варианты оставить на последнюю ветку default

return "рубля";
}
}
else if(rub.length() > 1){
Copy link

@MagicUnderHood MagicUnderHood Nov 23, 2022

Choose a reason for hiding this comment

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

Проверку можно упростить, если использовать (int) Math.floor(pay), и от него брать %10 для вычисления последней цифры и %100 для выяснения, что число между 11 и 19

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

Reviewers

1 more reviewer

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