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

solution to jv-salary-info #1354

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

Conversation

SnkvS
Copy link

@SnkvS SnkvS commented Oct 19, 2024

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.

It looks like there are a couple of critical issues that need to be addressed: the use of a LinkedHashMap and the need to make the formatter a constant. Once these are resolved, your code will be in great shape! Keep up the good work and feel free to reach out if you need any help. 😊

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

@@ -1,7 +1,47 @@
package core.basesyntax;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.LinkedHashMap;

Choose a reason for hiding this comment

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

Using a LinkedHashMap is not recommended according to the checklist. Try to solve the task without using Map or any other similar data structures.

public class SalaryInfo {
private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy");

Choose a reason for hiding this comment

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

The formatter should be a constant field as per the checklist. Consider making it a constant.

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 following the checklist by using System.lineSeparator() and defining the formatter as a constant! 🎉 However, remember to use descriptive variable names for better code readability, like renaming 'n' to 'employeeName'. Keep up the good work and learn from these suggestions to enhance your coding skills!

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

public class SalaryInfo {
private static DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("dd.MM.yyyy");

Choose a reason for hiding this comment

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

The formatter is correctly defined as a constant field, which is a good practice according to the checklist.

int money = 0;
for (String record : data) {
String[] arr = record.split(" ");
String n = arr[1];

Choose a reason for hiding this comment

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

The variable name 'n' is not informative. According to the checklist, variable names should be descriptive. Consider renaming it to something like 'employeeName'.

StringBuilder builder = new StringBuilder();
builder.append("Report for period ").append(from).append(" - ").append(to);
for (String record : results) {
builder.append(System.lineSeparator())

Choose a reason for hiding this comment

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

Good use of System.lineSeparator() for handling line separators, as recommended in the checklist.

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.

3 participants