Skip to content

первое домашнее задание - #96

Open
Bivis63 wants to merge 1 commit into
Yandex-Practicum:masterfrom
Bivis63:master
Open

Bivis63 wants to merge 1 commit into
Yandex-Practicum:masterfrom
Bivis63:master

Conversation

@Bivis63

@Bivis63 Bivis63 commented Oct 26, 2022

Copy link
Copy Markdown

Моё первое домашнее задание на YandexPracticum.
С уважение Сергей Клушин.

import java.util.Scanner;

public class Calculate {
static String toComplete = "завершить";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

static можно убрать

}

while (price <= 0) {
if (price <= 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

В while уже проверяется это условие, if можно убрать

public String GetRubleAddition(double num) {
int numToInt = (int) num;
double preLastDigit = num % 100 / 10;
if (preLastDigit == 1) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Из-за того, что переменная типа double, это условие сработает только для num = 10. Если бы была int, работало бы для 11-19

case 4:
return "Человека";
default:
return "рублей";

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
System.out.println("некоректное значение для подсчета.Введите колличество человек заного ");
human = scanner.nextInt();
}
if (human == 1) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Поскольку в while может быть только human <= 1, а human < 1 проверено в верхнем if, тут можно сделать просто else к нему

@Bivis63

Bivis63 commented Oct 27, 2022 via email

Copy link
Copy Markdown
Author

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