Skip to content

Первая сдача работы - #1

Merged
Damir-jan merged 1 commit into
mainfrom
dev
Jul 16, 2023
Merged

Damir-jan merged 1 commit into
mainfrom
dev

Conversation

@Damir-jan

Copy link
Copy Markdown
Owner

No description provided.

@Damir-jan
Damir-jan merged commit 720566c into main Jul 16, 2023
Comment thread src/main/java/Main.java
System.out.println(Main.class.getPackage().getName());
int numberOfGuests = 0;

Scanner scanner = new Scanner(System.in);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Рекомендация: хорошей практикой является сделать scanner.close() после того, как он больше не используется

Comment thread src/main/java/Main.java
{
break;
}
if (prodName.matches("[а-яА-Я]+")) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Рекомендация: а что, если название товара содержит латинские буквы и/или цифры

Comment thread src/main/java/Main.java
myBusket.displayProducts();
double result = ProductBusket.finalPrice / numberOfGuests;
double finalResult = Math.round(result * 100.0) / 100.0;
System.out.println( "Каждый гость заплатит: " + finalResult + " " + rubleDeclination(finalResult) + ".");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Рекомендация: вывод лучше делать через аргументы, а не через конкатенацию (оператор +)

public class Product {

// Fields (instance variables)
public String name;

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