Open
Conversation
qlido
requested changes
May 24, 2023
|
|
||
| print(getScore()); | ||
|
|
||
| return true; |
Member
There was a problem hiding this comment.
항상 true가 반환 된다면 그냥 void함수가 좋지 않을까요?
| public boolean block(int shoot){ | ||
| Random random = new Random(); | ||
| int blockShoot = random.nextInt(5) + 3; | ||
| if (shoot >= 2 && shoot <= 7 && keep_count > 0){ |
| keep_count -= 1; | ||
| return shoot != blockShoot; | ||
| } | ||
| if (shoot >= 2 && shoot <= 8){ |
|
|
||
| boolean shootBool = keeper.block(shoot); | ||
|
|
||
| if (shootBool){ |
Comment on lines
+21
to
+25
| public void print(int score){ | ||
| for(int i = 0; i < score; i++){ | ||
| System.out.print("-"); | ||
| } | ||
| } |
Comment on lines
+6
to
+22
| String[] names = inputNames("공격수"); | ||
| Attacker attacker1 = new Attacker(names[0]); | ||
| Attacker attacker2 = new Attacker(names[1]); | ||
|
|
||
| names = inputNames("미드필더"); | ||
| Midfielder midfielder1 = new Midfielder(names[0]); | ||
| Midfielder midfielder2 = new Midfielder(names[1]); | ||
|
|
||
| names = inputNames("골키퍼"); | ||
| Keeper keeper = new Keeper(names[0]); | ||
|
|
||
| int matchPoint = inputMatchPoint(); | ||
| boolean bool = true; | ||
|
|
||
| int count = 1; | ||
|
|
||
| Soccer[] soccers = new Soccer[] {attacker1, attacker2, midfielder1, midfielder2}; |
| System.out.printf("\n%d번째 슈팅결과", count); | ||
| printResult(soccers, keeper); | ||
| count++; | ||
| bool = check(attacker1, attacker2, midfielder1, midfielder2, matchPoint); |
jacobhboy
reviewed
May 25, 2023
| @@ -0,0 +1,27 @@ | |||
| public abstract class Soccer{ | |||
Contributor
There was a problem hiding this comment.
Soccer라는 네이밍에 대해서 고민해봐야할 것 같아요. Soccer가 뭐죠?
| goal(); | ||
| } | ||
|
|
||
| print(getScore()); |
Contributor
There was a problem hiding this comment.
공격수도 그렇고 print(getScore())라는 로직을 가지고 있는데, printScore()메서드를 만드는 것이 더 효율적이고, 깔끔한 것 같습니다.
|
|
||
| print(getScore()); | ||
|
|
||
| return true; |
| @@ -0,0 +1,28 @@ | |||
| import java.util.Random; | |||
|
|
|||
| public class Keeper extends Soccer{ | |||
Contributor
There was a problem hiding this comment.
굳이 Keeper가 Soccer를 상속받을 필요는 없습니다.
Comment on lines
+10
to
+12
| public boolean shoot(Keeper keeper){ | ||
| return false; | ||
| } |
Contributor
There was a problem hiding this comment.
이런 로직이 굳이 상속을 받아서 생긴 것이죠.
| import javax.accessibility.AccessibleTable; | ||
| import java.util.Scanner; | ||
|
|
||
| public class SoccerGameApplication { |
Contributor
There was a problem hiding this comment.
이 클래스의 책임이 너무 많은 것 같아요. 작게는 문자를 출력하는 것부터, 크게는 핵심 로직까지 다 이 클래스가 책임지고 있습니다.
qlido
reviewed
May 27, 2023
| return matchPoint; | ||
| } | ||
|
|
||
| static boolean check(Attacker attacker1, Attacker attacker2, Midfielder midfielder1, Midfielder midfielder2 ,int matchPoint){ |
Comment on lines
+35
to
+36
| isNotGameDone = check(attacker1, matchPoint) && check(attacker2, matchPoint) | ||
| && check(midfielder1, matchPoint) && check(midfielder2, matchPoint); |
| Scanner sc = new Scanner(System.in); | ||
| System.out.print("매치포인트를 입력하세요 : "); | ||
|
|
||
| int matchPoint = sc.nextInt(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
전유진 과제 제출합니다