Skip to content

Implement salary info calculation - #1598

Open
kbukatiuk wants to merge 1 commit into
mate-academy:masterfrom
kbukatiuk:master
Open

Implement salary info calculation#1598
kbukatiuk wants to merge 1 commit into
mate-academy:masterfrom
kbukatiuk:master

Conversation

@kbukatiuk

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor 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.

Review Summary

Your implementation correctly fulfills all functional requirements. The date range filtering, parsing logic, and output formatting work as expected using appropriate Java 8+ APIs. While there are two checklist violations regarding constants (DateTimeFormatter should be a class-level constant per item #2, and the regex pattern and array indices should be named constants per item #9), these are code style improvements rather than functional blockers since the code produces correct results. The core logic is sound and the implementation passes the required functionality tests.


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

Footnotes

  1. Rate AI review example

public class SalaryInfo {
public String getSalaryInfo(String[] names, String[] data, String dateFrom, String dateTo) {
return null;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #2: 'If you create a formatter, make it a constant field'. Move the DateTimeFormatter to be a private static final constant at the class level.

int totalSalary = 0;

for (String record : data) {
String[] parts = record.split("\\s+");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #9: 'Any magic numbers should be constants'. The regex pattern "\\s+" should be defined as a constant with an informative name (e.g., DATA_ENTRY_SPLITTER).

Comment on lines +26 to +27
int hours = Integer.parseInt(parts[2]);
int salaryPerHour = Integer.parseInt(parts[3]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #9: 'Any magic numbers should be constants'. Array indices 2 (hours) and 3 (salary per hour) should be defined as named constants for better readability.

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