Skip to content

Калькулятор#1

Open
JaneK2000 wants to merge 2 commits intomainfrom
dev
Open

Калькулятор#1
JaneK2000 wants to merge 2 commits intomainfrom
dev

Conversation

@JaneK2000
Copy link
Copy Markdown
Owner

Выполнение проекта

int price= (int) (allPrices/kol);
if(price % 100 > 10 && price % 100 < 20 || price % 10 == 0 || price % 10 > 4) System.out.println("Каждый должен заплатить "+ String.format("%.2f", allPrices/kol)+ " рублей");
else if(price % 10 > 1 && price % 10 < 5) System.out.println("Каждый должен заплатить "+ String.format("%.2f", allPrices/kol)+ " рубля");
else System.out.println("Каждый должен заплатить "+ String.format("%.2f", allPrices/kol)+ " рубль");
Copy link
Copy Markdown

@gusar-off gusar-off Jan 21, 2023

Choose a reason for hiding this comment

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

Плохо читаются такие условие, лучше расставить переносы и переписать на switch case


public Product(String nameGoods, double priceGoods) {
name=nameGoods;
price=priceGoods;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Лучше явно указывать this:

this.name = nameGoods;
this.price = priceGoods;

Scanner scanner = new Scanner(System.in);
while (true) {

System.out.println("Введите название товара");
Copy link
Copy Markdown

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