Skip to content

Приложение готово! - #61

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

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

Conversation

@MikhailKlepikov

Copy link
Copy Markdown

No description provided.

Comment thread src/main/java/Main.java
import java.util.Scanner;
public class Main {

private static String nounForm(double num)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Лучше называть методы глаголами. Например, getNounForm. О правилах нейминга можно почитать здесь:
https://github.com/qcha/JBook/blob/master/start/code_style.md
Также эта тема хорошо раскрывается во 2 главе книги Роберта Мартина "Чистый код".

Comment thread src/main/java/Main.java
if (num > 10) {
for (int i = 11; i < 15; i++) {
if (i == Integer.parseInt(numStr.substring(numStr.length() - 2))) {
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.

Решение обработки чисел с 11 до 14 с циклом работает, но, кажется, слишком усложнено)

Copy link
Copy Markdown
Author

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/Main.java

while(true)
{
String prodName = null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Если мы создаем переменную и не задаем ей изначальное значение, то она и так будет равна null, т.е. задавать ей null излишне

Comment thread src/main/java/Main.java
System.out.println("Введите стоимость товара:");
double price = 0;
while(true)
{

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(true) { - таков кодстайл. Некритично, но в реальных проектах обычно стараются соблюдать единообразие стиля.

@@ -0,0 +1,2 @@
public class numOfPeople {

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