Skip to content

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

Open
Vasil9202 wants to merge 5 commits intomainfrom
master
Open

Проектная работа №1#1
Vasil9202 wants to merge 5 commits intomainfrom
master

Conversation

@Vasil9202
Copy link
Copy Markdown
Owner

No description provided.


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

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants