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

done #1392

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

done #1392

wants to merge 5 commits into from

Conversation

mizuo-san
Copy link

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.

Great job on implementing the SalaryInfo class! 🎉 Your code meets all the task requirements and constraints, and it's well-structured and readable. The only suggestion is to consider renaming the getSalesByName method to something more descriptive like calculateSalariesByName to better reflect its functionality. Keep up the excellent work and happy coding! 😊

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

String[] splitData = datum.split(" ");
LocalDate dataNow = LocalDate.parse(splitData[0], formatter);
if ((dataFrom.isBefore(dataNow) || dataFrom.isEqual(dataNow)) && (dataTo.isAfter(dataNow) || dataTo.isEqual(dataNow))) {
getSalesByName(names, splitData, salariesByName);

Choose a reason for hiding this comment

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

The method name getSalesByName is misleading as it suggests retrieving sales data, but it actually calculates salaries. Consider renaming it to something like calculateSalariesByName to better reflect its purpose.

String[] data,
String dateFrom,
String dateTo) {
final DateTimeFormatter formatter = DateTimeFormatter

Choose a reason for hiding this comment

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

make it class-level constant

private static void calculateSalariesByName(String[] names,
String[] splitData,
int[] salariesByName) {
for (int j = 0; j < names.length; j++) {

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Maybe you can give me a small hint how i can reduse loops count? Cuz i honestly have no idea how to remove one of that loops

int[] salariesByName) {
for (int j = 0; j < names.length; j++) {
if (splitData[1].equals(names[j])) {
int countOfHours = Integer.parseInt(splitData[2]);

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 all magic numbers

Copy link
Author

Choose a reason for hiding this comment

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

You say about numbers 1 and 2?

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