Skip to content

калькулятор еды - #1

Open
Bearmanchik wants to merge 7 commits into
mainfrom
dev
Open

Bearmanchik wants to merge 7 commits into
mainfrom
dev

Conversation

@Bearmanchik

Copy link
Copy Markdown
Owner

итоговый вариант работы

Comment thread src/main/java/Main.java Outdated

while (countPeople < 2) {
System.out.println("На скольких людей разделить счет?");
countPeople = scanner.nextInt();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Если передать в этот момент произвольную строку программа завершит работу с исключением. Перед тем, как прочитать инт из сканнера, нужно сначала проверить возможно ли это при помощи соответствующего метода hasNextInt

Comment thread src/main/java/Main.java Outdated
System.out.println("Укажите имя товара");
name = scanner.next();
System.out.println("Укажите цену товара");
cost = scanner.nextDouble();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Тоже самое только hasNextDouble

Comment thread src/main/java/Formatter.java Outdated
@@ -0,0 +1,29 @@
public class Formatter {
int cost;
/* Formatter (double formCost){

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/Formatter.java Outdated
@@ -0,0 +1,29 @@
public class Formatter {
int cost;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

можно сделать локальной переменной функции format

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