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

My hw01 #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed out/production/MyWayJava/Main.class
Binary file not shown.
16 changes: 16 additions & 0 deletions src/hw/one/GameScore.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package hw.one;

public class GameScore {

public static int GameForecastCalculator(int teamAscore, int teamBscore, int teamAscoreGuess, int teamBscoreGuess) {

Choose a reason for hiding this comment

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

remove redundant line

if (teamAscore == teamAscoreGuess && teamBscore == teamBscoreGuess) {

Choose a reason for hiding this comment

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

use ternary operator here

return 2;
} else if ((teamAscore > teamBscore && teamAscoreGuess > teamBscoreGuess)
|| (teamAscore < teamBscore && teamAscoreGuess < teamBscoreGuess)
|| (teamAscore == teamBscore && teamAscoreGuess == teamBscoreGuess)) {
return 1;
}
return 0;
}
}
11 changes: 11 additions & 0 deletions src/hw/one/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package hw.one;

public class Main {

Choose a reason for hiding this comment

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

Why do you need this class?

Copy link
Owner Author

Choose a reason for hiding this comment

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

To test other classes.

public static void main(String[] args) {


}

}


29 changes: 29 additions & 0 deletions src/hw/one/PowNumber.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package hw.one;

public class PowNumber {
public static double sqrtNum(int number) {
double result;

Choose a reason for hiding this comment

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

write
return number * number;
and delete
double result;

return result = number * number;
}

public static double cubeNum(int number) {
double result;

Choose a reason for hiding this comment

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

the same

return result = number * number * number;
}


public static double PowNum(int number, int pow) {
double result = 1;
if (pow > 0) {
for (int i = pow; i > 0; i--) {
result *= number;
}
} else if (pow < 0) {
for (int i = pow; i < 0; i++) {
result /= number;
}
}
return result;
}

Choose a reason for hiding this comment

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

remove redundant line

}