Skip to content

Задание на проверку - #1

Open
Alkrasen wants to merge 4 commits into
mainfrom
master
Open

Alkrasen wants to merge 4 commits into
mainfrom
master

Conversation

@Alkrasen

Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/main/java/Calculator.java Outdated
String close;
while(true){
System.out.println("Введите название блюда!");
Scanner scSecond = 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.

Лучшее переиспользовать инстанс сканнера, а не создавать каждый раз новый.

Comment thread src/main/java/Finish.java Outdated
public static String finish(float overallCost) {
String suffix;
int hundred = (int) Math.floor(overallCost % 100);
if (hundred <= 20 && hundred >= 5) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Тут на самом деле достаточно будет интервала от 11 до 14 включительно, потому все остальные окончания будут совпадать

Comment thread src/main/java/Calculator.java Outdated
if(price > 0 ){
sumOfOrder = sumOfOrder + price;
String sufForOne = Finish.finish(price);
System.out.println("Вы добавили " + dish + " за " + price + sufForOne );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

В таких случаях для вывода лучше использоватьSystem.out.printf, ему можно передать параметры, которые будут поставлены в строку.

Comment thread src/main/java/Calculator.java Outdated
System.out.println("Хотите добавить блюдо? Введите любую букву или напишите:'Завершить', если блюд больше не осталось");
Scanner scFourth = new Scanner(System.in);
close = scFourth.next();
if (close.equalsIgnoreCase("Завершить")){

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