Skip to content

Calc finished - #3

Open
personBit wants to merge 3 commits into
devfrom
Calc-finished
Open

personBit wants to merge 3 commits into
devfrom
Calc-finished

Conversation

@personBit

@personBit personBit commented May 11, 2024 •

Copy link
Copy Markdown
Owner

Сначало коммитнул, и уже потом отправил на pull случайно. Исправленный кусок кода выглядит так:

 public String rubleFormat(double price) { // определяем формат слова "рубль"
        int priceInt = (int) price;

        rubleFormat = priceInt % 10;
        int rubleFormatH = priceInt % 100;
        if (price > 100 && (rubleFormatH == 11 || rubleFormatH == 12 || rubleFormatH == 13 || rubleFormatH == 14)) {
            return "рублей";
        } else if (priceInt == 11 || priceInt == 12 || priceInt == 13 || priceInt == 14) {
            return "рублей";
        } else if (rubleFormat == 1) {
            return "рубль";
        } else if (rubleFormat == 2 || rubleFormat == 3 || rubleFormat == 4) {
            return "рубля";
        } else {
            return "рублей";
        }
}

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.

1 participant