Skip to content

Калькулятора счёта - #1

Open
AlexandrFedoseev-1 wants to merge 4 commits into
mainfrom
dev
Open

AlexandrFedoseev-1 wants to merge 4 commits into
mainfrom
dev

Conversation

@AlexandrFedoseev-1

Copy link
Copy Markdown
Owner

No description provided.

@Charmandik Charmandik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Работа отличная, приятно читать и даже поправлять нечего)

public class Formatter {
public String formatterRub(double price){
double intPrice = Math.floor(price);
if (intPrice%10==1 && intPrice%100!=11){

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

для ситуаций, когда условий больше 2, лучше использовать оператор switch-case

double intPrice = Math.floor(price);
if (intPrice%10==1 && intPrice%100!=11){
return "рубль";
}else if (intPrice%10>=2 & intPrice%10<=4 & !(intPrice%100>=12 & intPrice%100<=14)){

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🍏Настоятельно рекомендую удалять неиспользуемый код, а также использовать комбинацию ctrl+alt+l (https://stackoverflow.com/questions/17879475/how-enable-auto-format-code-for-intellij-idea) для автоматического форматирования кода.

Comment thread src/main/java/Main.java
System.out.println(String.format("Каждый человек должен заплатить: %.2f %s",calculator.splitCheck(),
formatter.formatterRub(calculator.splitCheck())));
System.out.println("Чтобы посчитать новый чек введите любой символ, чтобы завершить введите \"Завершить\"" );
if ("Завершить".equalsIgnoreCase(scanner.next().trim()))

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