Skip to content

Pull Request - #1

Open
SAndreyV1683 wants to merge 7 commits into
mainfrom
dev
Open

SAndreyV1683 wants to merge 7 commits into
mainfrom
dev

Conversation

@SAndreyV1683

Copy link
Copy Markdown
Owner

Это мой первый Pull Request

calculate(product);
}

public void calculate(Product product) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Привет. Этот метод можно сделать приватным, потому что он используется только в классе Calculator. Не критично.

Comment thread src/main/java/Formatter.java Outdated
@@ -0,0 +1,23 @@
public class Formatter {

float sum;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

на будущее, лучше явно указывать модификаторы доступа в java. Переменные без модификатора доступа по умолчанию являются package-private. Это не всегда подходящий модификатор.

Comment thread src/main/java/MScanner.java Outdated
System.out.println("Введите стоимость товара.");
float price = 0;
boolean isFloat = false;
do {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

несколько вложенных циклов do-while плохо читаются. Хорошим подходом будет вынести вложенный цикл в отдельную функцию

Comment thread src/main/java/MScanner.java Outdated
do {
if (scanner.hasNextFloat()){
price = scanner.nextFloat();
if (price < 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.

Привет! Поскольку ты используешь дробные значения, этим условием ты отсекаешь цены от 0 до 1. Правильным условием является if(price <= 0).

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