-
Notifications
You must be signed in to change notification settings - Fork 0
Проектная работа №1 «Калькулятора счёта». #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/main/java/Main.java
Outdated
| int numberOfGuests; | ||
|
|
||
| while (true) { | ||
| System.out.println("На скольких человек необходимо разделить счёт.: "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Стилистически тут лучше поставить вопросительный знак в конце
src/main/java/Calculator.java
Outdated
|
|
||
|
|
||
| public Calculator() { | ||
| products = new Product[100]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут цифра 3, потому что я поменял с 100 на 3, так как вводить долго. Но такое теоретически возможно
src/main/java/Calculator.java
Outdated
| String formattedTotalCost = Formatter.formatTotalCost(totalCost); | ||
| System.out.println("Общая стоимость товаров: " + formattedTotalCost); | ||
| } | ||
| public void run() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Судя по названию метода - надо бежать. Лучше называть по смыслу того, что происходит внутри или возвращает
1. Фиксированный массив заменен на ArrayList, что не ограничивает в колличестве товаров. 2. Исправлена стилистика 1-ого вопроса. 3. Переименован метод "run()" - makeBasketProducts()
|
Исправлены недочеты и краш программы при неизвестном количестве товаров. |

Сдача на ревью кода java «Калькулятора счёта».
Добавлен класс "Calculator", содержащий логику добавления и подсчёта товаров.
Добавлен класс "Product" с полями "имя" — строка и "цена" — дробное значение.
Добавлен класс "Formatter", содержащий метод получения слова рубль в правильном падеже.