-
Notifications
You must be signed in to change notification settings - Fork 12
Fifth #7
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
base: master
Are you sure you want to change the base?
Fifth #7
Conversation
| } No newline at end of file | ||
| public static void main(String[] args) { | ||
|
|
||
| makeGood maker = new makeGood(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strongly recommend having class names that start with an uppercase letter, not lowercase.
| try(Scanner scanner = new Scanner(file)) { | ||
| int n = scanner.nextInt(); | ||
| int m = scanner.nextInt(); | ||
| // n - число неизвестных (без ответа), m - число уравнений |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can write comments in English? Think about someone reading your code and improve the functionality. He won't understand anything in your comments. And also, consider using better names for the variables (this way you won't even use a comment to describe the code, the self-describing code is always better than a comment).
|
|
||
| matrix.steppedViewDown(); | ||
| } catch (FileNotFoundException e) { | ||
| System.out.println("I hope that never happen"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe there needs to be something more describing the exception. In case it happens you will know what causes the exception to happen and then fix the bug or add some readable output on what causes the exception to happen.
| import java.io.FileNotFoundException; | ||
| import java.io.FileWriter; | ||
| import java.io.IOException; | ||
| class Matrix { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let the code be more readable and add here an empty line to distinguish imports and the class definition.
| this.M = m; | ||
| } | ||
| // true - ненулевое | ||
| boolean checkValue(int i, int j) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the comment and rename the method something like "isNotZero".
| try (FileWriter writer = new FileWriter(file)) { | ||
| writer.write(s); | ||
| } catch (IOException e) { | ||
| System.out.printf("Exception"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the program prints "Exception" it gives you nothing to fix it. It doesn't print where the exception happened. So, if you have a lot of these you wouldn't even know where the exception happened.
| return (this.checkNonzero(i + 1, j) || this.checkValue(i, j)); | ||
| } | ||
| else { | ||
| return this.checkValue(i, j); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you using "this" everywhere. It is not necessary to write in places where it is not ambiguous. When you have the local variable that has the same name as your class member variable then you need to use "this" and nowhere else.
| this.rows[i] = this.rows[j]; | ||
| this.rows[j] = row; | ||
| } | ||
| String getString() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use empty lines to separate different methods.
| */ | ||
| class Row { // N на 1 больше, чем вход, т.к. тут я учитываю и ответ (то, что справа от равно) | ||
| int N; | ||
| ComplexNumber[] line = new ComplexNumber[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to write an initial value for the array if you will rewrite it anyway. Like in the constructor.
| @@ -0,0 +1,45 @@ | |||
| class makeGood { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I wrote above, the name of the class should start with an uppercase letter.
Hi!
Check this out plz, btw probably I found a mistake in test output
I checked answer which I get by that program and find out that it is correct