Skip to content
This repository was archived by the owner on Oct 25, 2021. It is now read-only.

Krylosov_Arkady#33

Open
KrArkadiy wants to merge 67 commits intomasterfrom
feature/KrylosovArkady
Open

Krylosov_Arkady#33
KrArkadiy wants to merge 67 commits intomasterfrom
feature/KrylosovArkady

Conversation

@KrArkadiy
Copy link
Collaborator

No description provided.

@KrArkadiy KrArkadiy added the readyForReview Sign for Artem to take a look label Jul 9, 2021
@NikolaevArtem NikolaevArtem added HW_1 Good to go and removed readyForReview Sign for Artem to take a look labels Jul 11, 2021
@NikolaevArtem NikolaevArtem changed the title feature/KrylosovArkady Krylosov_Arkady Jul 11, 2021
@KrArkadiy KrArkadiy added the readyForReview Sign for Artem to take a look label Jul 15, 2021
@KrArkadiy
Copy link
Collaborator Author

Homework_2 done.

@NikolaevArtem NikolaevArtem removed the readyForReview Sign for Artem to take a look label Jul 20, 2021
@KrArkadiy KrArkadiy added the readyForReview Sign for Artem to take a look label Jul 26, 2021
README.md Outdated
| --- | --- | --- |
| HW1 | [Console printer](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/master/src/main/java/homework_1) | The app that reads input arguments and prints them, until "error" argument |
| HW1 | [Console printer](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/KrylosovArkady/src/main/java/homework_1) | The app that reads input arguments and prints them, until "error" argument |
| HW2.1 | [Traffic Light](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/KrylosovArkady/src/main/java/homework_2/trafficLight) | The app that reads input arguments and output, what traffic light color it would be in inputted time. User has an opportunity to enter time in 2 formats |
Copy link
Collaborator

Choose a reason for hiding this comment

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

check links for hw2


public class CommandLineArgs {

public static final String ANSI_RED = "\u001B[31m";
Copy link
Collaborator

Choose a reason for hiding this comment

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

fix access modifier

@@ -0,0 +1,20 @@
package Homework_1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

fix name package

Comment on lines 26 to 29
} catch (NumberFormatException | IOException exception) {

}
return -1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
} catch (NumberFormatException | IOException exception) {
}
return -1;
} catch (NumberFormatException | IOException exception) {
return -1;
}

will it work this way?

Comment on lines 14 to 20
if (negativeInput(input)) {
System.out.println(ERROR);
} else if (input == 0) {
System.out.println();
} else {
printResult(input);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (negativeInput(input)) {
System.out.println(ERROR);
} else if (input == 0) {
System.out.println();
} else {
printResult(input);
}
if (negativeInput(input)) {
System.out.println(ERROR);
} else {
printResult(input);
}

and
private void printResult(int input) {
String output = "";
for (int i = 0; i < input; i++) {
output += "x";
}
System.out.println(output);
}
will it work this way?

Comment on lines 90 to 98
int counter = 0;
while (counter < result.length()) {
if (counter == result.length() - 1) {
System.out.print(result.charAt(counter));
break;
}
System.out.print(result.charAt(counter) + ", ");
counter++;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
int counter = 0;
while (counter < result.length()) {
if (counter == result.length() - 1) {
System.out.print(result.charAt(counter));
break;
}
System.out.print(result.charAt(counter) + ", ");
counter++;
}
for (int i = 0; i < result.length(); i++) {
if (i == result.length() - 1) {
System.out.print(result.charAt(i));
break;
}
System.out.print(result.charAt(i) + ", ");
}

opt

protected void trafficLightColorDetection(int sec) {
if (sec % 60 < 35) {
System.out.print(ANSI_GREEN + "Green light" + ANSI_RESET);
} else if (sec % 60 >= 35 && sec % 60 < 40 || sec % 60 >= 55) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
} else if (sec % 60 >= 35 && sec % 60 < 40 || sec % 60 >= 55) {
} else if (sec % 60 < 40 || sec % 60 >= 55) {

}
}

protected boolean isNegative(int input) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

extra method

return input < 0;
}

private boolean dayOverCheck(int input) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

extra method

return input <= 86399;
}

private boolean isDigit(String input) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can to combine isNegative, dayOverCheck and isDigit how validationInput for example

public void run2(String filename) {
isCorrectFilename(filename);
try{
Files.lines(Path.of(getPath(filename))).map(x->x.replaceAll("[,.]","")).forEach(System.out::println);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Path.of() don't exist in java 8

Comment on lines +9 to +14
private char[][] array;
private String strategy;
private String inputData;
private String result;
private int rows;
private int columns;
Copy link
Owner

Choose a reason for hiding this comment

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

Opt: these should be either local variables or return values

}
}

private void parseData(String s){
Copy link
Owner

Choose a reason for hiding this comment

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

Opt: As example, this method should return String array

Comment on lines +5 to +11
TrafficLight trafficLight = new TrafficLight();
TrafficLightExtraMod trafficLightExtraMod = new TrafficLightExtraMod();
if(args[0].equals("seconds")){
trafficLight.run();
} else {
trafficLightExtraMod.run();
}
Copy link
Owner

Choose a reason for hiding this comment

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

Opt: instantiate obj just if the requirement matches

@NikolaevArtem
Copy link
Owner

Good job with HW_2!

@NikolaevArtem NikolaevArtem added HW_2 and removed bug Code fix needed labels Sep 2, 2021

public class Main {
public static void main(String[] args) {
Runner runner = new Runner();
Copy link
Owner

Choose a reason for hiding this comment

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

Seems broken:
image
Also, please introduce automatic ship placement

Copy link
Owner

Choose a reason for hiding this comment

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

Also, if input is wrong, the app just shuts down. Really annoying in case you make a typo right before the end :)

Copy link
Owner

Choose a reason for hiding this comment

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

image

Copy link
Owner

Choose a reason for hiding this comment

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

image

Copy link
Owner

Choose a reason for hiding this comment

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

Have you played your own game?)
Sorry, can't approve a this state

@NikolaevArtem NikolaevArtem added bug Code fix needed and removed readyForReview Sign for Artem to take a look readyForStudentReview labels Sep 23, 2021
No setters.
*/

final class ImmutableClass {
Copy link
Owner

Choose a reason for hiding this comment

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

Your class is mutable 100%

@NikolaevArtem NikolaevArtem added HW_5 HW_6 HW_7 and removed bug Code fix needed labels Sep 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants