Skip to content

console project - #1

Open
4erepashkaIT wants to merge 1 commit into
mainfrom
dev
Open

4erepashkaIT wants to merge 1 commit into
mainfrom
dev

Conversation

@4erepashkaIT

Copy link
Copy Markdown
Owner

Ура, я сделал это!

Comment thread src/main/java/Calc.java

ArrayList<Product> productList = new ArrayList<>();
public static float addProduct(float sum, Scanner scanner,ArrayList<Product> productList) {
Padesh padesh = new Padesh();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Инстанс класса создавать не обязательно. У тебя внутри класса одна статическая функция, так что сам класс тоже можно пометить статическим и использовать функцию без создания объекта: Padesh.padesh(...)

Comment thread src/main/java/Padesh.java
String finalRubles;
int ost = (int)rubles;
ost %= 10;
if (((int)rubles)%100>10 && ((int)rubles)%100<15) {

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)rubles)%100> можно сохранить в локальную переменную и использовать его, чтобы данное вычисление сделать один раз, вместо двух

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