diff --git a/README.md b/README.md index 1aefef938..e04c838ae 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ # jv-salary-info -Implement method `getSalaryInfo(String[] names, String[] data, String dateFrom, String dateTo)`. It should calculate -salary for employees. As input you receive two arrays and two dates in String format. - - Date represents limits that you should meet while calculation salary for employees (inclusively). - - First array (`names`) contains names of employees you should calculate salary for. - - Second array (`data`) contains info about their working hour during particular day and income per hour. -Method should return info in the following format: +Implement method `getSalaryInfo(String[] names, String[] data, String dateFrom, String dateTo)`. It should calculate the salary for employees. As input, you receive two arrays and two dates in String format. + - Date represents limits that you should meet while calculating salary for employees (inclusively). + - The first array (`names`) contains the names of employees you should calculate salary for. + - The second array (`data`) contains info about their working hour during the particular day and income per hour. + +The method should return info in the following format: ``` Report for period #date_1# - #date_2# #Name of employee# - #money earned# ``` -Here is sample of input data. +Here is a sample of input data. Dates format: ``` date from = `01.04.2019 ` @@ -43,4 +43,4 @@ Method execution result: Andrew - 1050 Kate - 1800 ``` -### [Try to avoid these common mistakes while solving task](https://mate-academy.github.io/jv-program-common-mistakes/java-core/exceptions/salary-info) +### [Try to avoid these common mistakes while solving task](./checklist.md) diff --git a/checklist.md b/checklist.md index f51c0868c..fb55786b8 100644 --- a/checklist.md +++ b/checklist.md @@ -1,27 +1,23 @@ ## Common mistakes (jv-salary-info) -#### Don't begin class or method implementation with empty line. +#### Don't begin class or method implementation with an empty line. Remove all redundant empty lines, be careful :) #### If you create a [formatter](https://docs.oracle.com/javase/tutorial/datetime/iso/format.html), make it a constant field. If you create a formatter, make it a [constant](https://mate-academy.github.io/style-guides/java/java.html#s5.2.4-constant-names). That will make your code easier to understand. Plus if you use it in several places in your code -you will be able to change its value easily with one action(change variable declaration). In other case you need to update -value in each place it's being used. +you will be able to change its value easily with one action(change variable declaration). In other cases, you need to update the value in each place it's being used. #### Use LocalDate instead of Date. Here is some [background](https://www.baeldung.com/migrating-to-java-8-date-time-api) why you should use it primarily. -#### Don't create redundant loops. Two is enough. +#### Don’t create redundant loops. Two is enough. The more loops you have, the slower your code may get, so try to solve task with minimum amount. -#### Don't use two-dimension arrays and HashMap(or any other Map). -They may simplify the work for you, but for now you will get more value from solving this task if you complete it -without using these data structures. Let's do it manually. +#### Don’t use two-dimension arrays and HashMap(or any other Map). +They may simplify the work for you, but for now you will get more value from solving this task if you complete it without using these data structures. Let's do it manually. #### Use StringBuilder. -You have learned in previous topics about different internal structure of `String` and `StringBuilder` don't forget to use it -on practice. Keep in mind that String concatenation creates many new objects that take up a lot of memory if you use it inside -of a loop. Though it's safe to use it outside of a loop, because compiler will replace it with StringBuilder anyway [java doc](https://docs.oracle.com/javase/7/docs/api/java/lang/String.html) +You have learned in previous topics about different internal structures of `String` and `StringBuilder` don't forget to use them in practice. Keep in mind that String concatenation creates many new objects that take up a lot of memory if you use it inside of a loop. Though it's safe to use it outside of a loop because the compiler will replace it with StringBuilder anyway [java doc](https://docs.oracle.com/javase/7/docs/api/java/lang/String.html) #### Use System.lineSeparator Different OS handle line separators differently. Instead of using `\n` or `\r\n` use universal solution - `System.lineSeparator()`. #### Remember about informative names of the variables and methods. -Do not use abstract words like `string` or `array` as variable name. Do not use one-letter names. The name of the method should make it clear what it does. +Do not use abstract words like `string` or `array` as variable names. Do not use one-letter names. The name of the method should make it clear what it does. - Bad example: ```java String[] arr = new String[]{"Alex", "Bob", "Alice"}; @@ -41,4 +37,4 @@ Do not use abstract words like `string` or `array` as variable name. Do not use Your code should be easy to read. Move all hardcoded values to [constant fields](https://mate-academy.github.io/style-guides/java/java.html#s5.2.4-constant-names) and give them informative names. #### Write informative messages when you commit code or open a PR. -Bad example of commit/PR message: `done`/`fixed`/`commit`/`solution`/`added homework`/`my solution` and other one-word, abstract or random messages. +Bad examples of commit/PR messages: `done`/`fixed`/`commit`/`solution`/`added homework`/`my solution` and other one-word, abstract or random messages. diff --git a/pom.xml b/pom.xml index cfd914adf..c6c504ab2 100644 --- a/pom.xml +++ b/pom.xml @@ -9,10 +9,9 @@ 1.0-SNAPSHOT - 11 + 17 UTF-8 UTF-8 - 3.1.1 https://raw.githubusercontent.com/mate-academy/style-guides/master/java/checkstyle.xml @@ -31,7 +30,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.1.1 + 3.3.0 compile @@ -54,7 +53,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.7.0 + 3.8.0 ${jdk.version} ${jdk.version}