728x90
class Solution {
public int solution(String[] order) {
int answer = 0;
for (String s : order) {
if (s.contains("americano")) {
answer += 4500;
} else if (s.contains("cafelatte")) {
answer += 5000;
} else {
answer += 4500;
}
}
return answer;
}
}
728x90
반응형
'Algorithm > 프로그래머스' 카테고리의 다른 글
[알고리즘] 두 수의 합 Java (0) | 2023.06.19 |
---|---|
[알고리즘] 날짜 비교하기 Java (0) | 2023.06.18 |
[알고리즘] 주사위 게임 1 Java (0) | 2023.06.15 |
[알고리즘] 정수 찾기 Java (0) | 2023.06.15 |
[알고리즘] 꼬리 문자열 Java (0) | 2023.06.14 |