Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented method getSalaryInfo #1387

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yaroslav-pryshchepa
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Great job on implementing the SalaryInfo class! 🎉 Your solution meets the task requirements effectively, and you've used best practices like StringBuilder and LocalDate. While there's a minor formatting issue with the initial line separator in the report, it doesn't impact the core functionality. Keep up the good work, and consider refining the string formatting for even cleaner output in the future. Well done! 👏

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

}
builder.append(System.lineSeparator()).append(name).append(" - ").append(salary);
}
return "Report for period " + dateFrom + " - " + dateTo + builder;

Choose a reason for hiding this comment

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

The return statement concatenates the report header with the salary information using the StringBuilder. However, the builder starts with a line separator, which might lead to an unexpected format in the report. Consider adjusting the StringBuilder initialization or appending logic to ensure the format matches the expected output.

Copy link

@okuzan okuzan left a comment

Choose a reason for hiding this comment

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

Clean code! Almost done

return null;
LocalDate dateFromFormed = LocalDate.parse(dateFrom, FORMATTER);
LocalDate dateToFormed = LocalDate.parse(dateTo, FORMATTER);
StringBuilder builder = new StringBuilder();
Copy link

Choose a reason for hiding this comment

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

uninformative naming, avoid naming String string, StringBuilder builder etc - name container types after what they store

int salary = 0;
for (String info: data) {
String[] information = info.split(" ");
LocalDate dateFormed = LocalDate.parse(information[0], FORMATTER);
Copy link

Choose a reason for hiding this comment

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

let's create constants for those indexes

Copy link

@liliia-ponomarenko liliia-ponomarenko left a comment

Choose a reason for hiding this comment

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

Great!

}
salaryAmount.append(System.lineSeparator()).append(name).append(" - ").append(salary);
}
return "Report for period " + dateFrom + " - " + dateTo + salaryAmount;

Choose a reason for hiding this comment

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

separator also should be a constant field

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.

4 participants