-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
My hw01 #1
Changes from 3 commits
76c0174
0c986ec
ab6f456
44e63a5
07d7623
ce57de2
0feddef
ebc75a7
f75ef69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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) { | ||
|
||
if (teamAscore == teamAscoreGuess && teamBscore == teamBscoreGuess) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package hw.one; | ||
|
||
public class Main { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need this class? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To test other classes. |
||
public static void main(String[] args) { | ||
|
||
|
||
} | ||
|
||
} | ||
|
||
|
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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. write |
||
return result = number * number; | ||
} | ||
|
||
public static double cubeNum(int number) { | ||
double result; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove redundant line |
||
} |
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 redundant line