-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
base: master
Are you sure you want to change the base?
Implemented method getSalaryInfo #1387
Conversation
There was a problem hiding this 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; |
There was a problem hiding this comment.
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.
There was a problem hiding this 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(); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this 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; |
There was a problem hiding this comment.
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
No description provided.