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

Java Assignment3 upload by Hyeonjinyun #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Java Assignment3 upload by hyeonjinyun
hybiis committed Apr 17, 2023
commit 02b7961a20b12b59246847d2900d1297ac591888
8 changes: 4 additions & 4 deletions Practice03/Electronics.java
Original file line number Diff line number Diff line change
@@ -68,25 +68,25 @@ public static Electronic findByProductNo(String productNo){
}

//3-3 전자제품들 중 인자로 주어진 제조 회사를 찾아서 하나의 배열에 반환하는 함수를 작성
public static Electronic[] groupByCompanyName(Company company){
public static List<Electronic> groupByCompanyName(Company company){

Choose a reason for hiding this comment

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

List가 아닌 배열을 반환하는 것이 요구사항인 것 같네요~

List<Electronic> groupByCompanyNamelist =new ArrayList<>();
for(int i=0; i<electroniclist.length;i++){
if(electroniclist[i].getCompanyName().equals(company)){
groupByCompanyNamelist.add(electroniclist[i]);
}
}
return null;
return groupByCompanyNamelist;
}

//3-4 전자제품들 중 인자로 주어진 인증 방법을 찾아서 하나의 배열에 반환하는 함수를 작성
public static Electronic[] groupByAuthMethod(AuthMethod authMethod){
public static List<Electronic> groupByAuthMethod(AuthMethod authMethod){

List<Electronic> groupByAuthMethodlist =new ArrayList<>();
for(int i=0; i<electroniclist.length;i++){
if(electroniclist[i].getArrAuth().equals(authMethod)){

Choose a reason for hiding this comment

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

배열과 객체를 비교하면 제대로 동작하지 않을 것 같습니다~

groupByAuthMethodlist.add(electroniclist[i]);
}
}
return groupByAuthMethodlist.toArray((new Electronic[groupByAuthMethodlist.size()]));
return groupByAuthMethodlist ;
}
}