Skip to content

Final version. Cosmetic changes2#115

Closed
manualcheg wants to merge 1 commit intoYandex-Practicum:masterfrom
manualcheg:master
Closed

Final version. Cosmetic changes2#115
manualcheg wants to merge 1 commit intoYandex-Practicum:masterfrom
manualcheg:master

Conversation

@manualcheg
Copy link
Copy Markdown

Приложение работает.
Выполняются все требования задания.
Реализовано 2 класса: Main, calc.

public static void input(int numberOfFriends) {
Scanner scanner = new Scanner(System.in);
String roubles;
String[] product = new String[100];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

В данном случае ввод ограничен 100 товарами, после чего программа завершится. Скорее всего до 100 товаров не дойдет, но лучше подстраховаться и использовать ArrayList

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.

Хотелось выполнить работу соответственно уровню знаний, которые нам дали.
Формально ни массивы, ни arrayList нам неизвестны.
Но со строковой переменной не хотелось, хотя и разобрался, как это можно было.

Ну и, да, в реальности выполнения программы до 100 товаров никто не доберётся. Впрочем, как и в жизни :)

Спасибо за ревью!

@@ -0,0 +1,70 @@
import java.util.Scanner;

public class calc {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Классы в Java принято называть с большой буквы
Про конвенции названий можно почитать здесь: https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html

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.

да, понял, что ошибся только перед pull request'ом :(


System.out.println("Программа \"Калькулятор счёта\"");
numberOfFriends = inputOfFriends();
calc.input(numberOfFriends);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Можно запустить программу одной строчкой
calc.input(inputOfFriends());

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.

Точно. Лишний код получился.

@manualcheg manualcheg closed this Mar 9, 2023
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