Skip to content

feat :: 우주 탐사 관리 시스템 - 탐사대원의 정보, 탐사선 정보 입력 및 출력#3

Open
fakesilverpark wants to merge 4 commits intoSPACE-FOR-SPACE:mainfrom
fakesilverpark:gaeun2
Open

feat :: 우주 탐사 관리 시스템 - 탐사대원의 정보, 탐사선 정보 입력 및 출력#3
fakesilverpark wants to merge 4 commits intoSPACE-FOR-SPACE:mainfrom
fakesilverpark:gaeun2

Conversation

@fakesilverpark
Copy link

과제를 진행하면서 느낀 것이라면 무엇이든 적어주세요, 고민, 이슈, 질문 등 다 좋습니다!

예를들어서 제가 vsc에서 test라는 폴더에 처음에는 a라는 파일만 만들어서 커밋하고 다음에는 b라는 파일을 만들어서 원래하듯히 커밋을 하려면 오류가 뜨는데 이런 경우에는 어떻게 해야하나요?


public class Spaceship {
private String spaceshipName; //탐사선이름
private String spaceshipHumanStatus; //탐사선이 무인인지 유인인지
Copy link
Member

Choose a reason for hiding this comment

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

Enum이라는 타입도 있으니 공부해 보시고 코드 개선해 보아도 좋을 것 같습니다!

Comment on lines 7 to 14
private List<Astronaut> astronauts = new ArrayList<>(); //탑승한 탐사 대원 리스트

Spaceship(){}

Spaceship(String spaceshipName, String spaceshipHumanStatus){
this.spaceshipName = spaceshipName;
this.spaceshipHumanStatus = spaceshipHumanStatus;
}
Copy link
Member

Choose a reason for hiding this comment

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

무인 우주선일 때는 리스트를 생성할 필요가 없으니 생성자에서 조건문을 사용해서 리스트 생성 로직을 분리해도 좋을 것 같습니다!

@GSB0203
Copy link
Member

GSB0203 commented Aug 5, 2024

적어주신 질문에 대해서 좀 더 자세히 설명해 주실 수 있으실까요?

Copy link
Member

Choose a reason for hiding this comment

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

무인과 유인에 따라서 변수가 필요없을 때도 있고 메서드 추가 조건문이 붙을 때도 있으니 상속을 사용해서 우주선 클래스를 만들고 무인선, 유인선 클래스를 각각 만들어서 우주선 클래스를 상속 받으면 좋을 것 같습니다!

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.

3 participants