Skip to content

Commit 852956f

Browse files
Made some checkstyle fixes
1 parent 1cc9580 commit 852956f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/main/java/core/basesyntax/SalaryInfo.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import java.time.format.DateTimeFormatter;
55

66
public class SalaryInfo {
7-
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy");
7+
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy");
8+
private static final int ONE_DAY = 1;
89

910
public String getSalaryInfo(String[] names, String[] data, String dateFrom, String dateTo) {
1011
StringBuilder stringBuilder = new StringBuilder("Report for period ");
@@ -20,7 +21,8 @@ public String getSalaryInfo(String[] names, String[] data, String dateFrom, Stri
2021
String[] splitData = data[j].split(" ");
2122

2223
LocalDate thisDate = LocalDate.parse(splitData[0], formatter);
23-
boolean hasDate = (thisDate.isAfter(startDate) && thisDate.isBefore(endDate.plusDays(1)));
24+
boolean hasDate = (thisDate.isAfter(startDate)
25+
&& thisDate.isBefore(endDate.plusDays(ONE_DAY)));
2426
boolean hasName = splitData[1].equals(names[i]);
2527

2628
if (hasDate && hasName) {
@@ -29,7 +31,8 @@ public String getSalaryInfo(String[] names, String[] data, String dateFrom, Stri
2931
}
3032
}
3133

32-
stringBuilder.append("\n").append(names[i]).append(" - ").append(sum);
34+
stringBuilder.append(System.lineSeparator())
35+
.append(names[i]).append(" - ").append(sum);
3336
}
3437

3538
return stringBuilder.toString();

0 commit comments

Comments
 (0)