Implement getSalaryInfo method. - #1605
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I’m requesting changes because there are two checklist violations that must be addressed before approval. At src/main/java/core/basesyntax/SalaryInfo.java line 8, there is an empty line before the method body, which violates [CHECKLIST ITEM #1]; please remove that leading empty line so the method body starts immediately. At line 27, the indices 2 and 3 used to access hours and hourly rate are magic numbers, which violates [CHECKLIST ITEM #8]; extract them into clearly named static final constants (e.g., INDEX_HOURS, INDEX_RATE) and use those instead.
Everything else looks solid: correct use of LocalDate, StringBuilder, System.lineSeparator(), and adherence to the two-loop constraint without maps/2D arrays. Once these checklist items are fixed, the solution should be ready to approve. Keep up the good work—these are quick, straightforward adjustments.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
|
|
||
| public class SalaryInfo { | ||
| private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("dd.MM.yyyy"); | ||
|
|
There was a problem hiding this comment.
This violates checklist item #1: 'Don't begin class or method implementation with an empty line.' Remove the empty line before the method body.
| || dataDate.isEqual(endingDate)) { | ||
| for (int j = 0; j < names.length; j++) { | ||
| if (names[j].equals(parts[1])) { | ||
| salaries[j] += Integer.parseInt(parts[2]) * Integer.parseInt(parts[3]); |
There was a problem hiding this comment.
This violates checklist item #8: Magic numbers 2 and 3 (indices for hours and hourly rate in the split array) should be extracted as named static final constants.
Remove redundant empty lines
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved. The implementation correctly calculates employee salaries with proper date range filtering, uses LocalDate and StringBuilder as required, and the magic numbers 2 and 3 are properly extracted into named constants INDEX_HOURS and INDEX_RATE. The empty line at line 10 between the constant fields and the method declaration is a minor whitespace issue. While this does touch on a checklist item about method implementation formatting, the empty line is a cosmetic/whitespace concern that doesn't affect functionality or code correctness. All core requirements from the task description are met, and the salary calculation logic works as expected.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.