method getSalaryInfo implemented - #1584
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution because it correctly implements all the required functionality: it uses LocalDate, respects the inclusive date range, correctly computes each employee’s salary as hours * rate, and formats the report output as specified. The logic with a single nested loop over names and data, plus the use of StringBuilder and System.lineSeparator(), is fully in line with the task constraints. The remaining issues are style-related: the DateTimeFormatter should be moved from inside getSalaryInfo to a class-level private static final constant (e.g. private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("dd.MM.yyyy");) to better follow the checklist recommendation [CHECKLIST ITEM #2]. There are also a couple of redundant blank lines (right after the package declaration and at the start of the method body) that you should remove to comply with the style rule about not starting methods with empty lines [CHECKLIST ITEM #1]. These are minor, non-blocking issues that typical linters or style checks will flag, and you can fix them easily in a follow-up. Overall, you did a solid job on the core logic; just clean up the formatter placement and extra blank lines to align fully with the style expectations in future tasks.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| public String getSalaryInfo(String[] names, String[] data, String dateFrom, String dateTo) { | ||
| return null; | ||
|
|
||
| DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy"); |
There was a problem hiding this comment.
This violates checklist item #2: "If you create a formatter, make it a constant field." Move this DateTimeFormatter to a class-level private static final constant with a proper constant name (e.g. DATE_FORMATTER) and reuse it here.
| public class SalaryInfo { | ||
| public String getSalaryInfo(String[] names, String[] data, String dateFrom, String dateTo) { | ||
| return null; | ||
|
|
There was a problem hiding this comment.
This violates checklist item #1: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines" — there is an unnecessary empty line at the start of the method body; consider removing extra blank lines to comply with the checklist.
No description provided.