Skip to content

Conversation

@shlyapugin-anton
Copy link

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

} No newline at end of file
public static void main(String[] args) {

makeGood maker = new makeGood();

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 - число уравнений
Copy link

@aaaaaa2493 aaaaaa2493 Jan 9, 2019

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");
Copy link

@aaaaaa2493 aaaaaa2493 Jan 9, 2019

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 {

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) {

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");

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);
Copy link

@aaaaaa2493 aaaaaa2493 Jan 9, 2019

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() {

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];

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 {

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.

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.

2 participants