November 2024
Intermediate to advanced
300 pages
7h 12m
English
Take a look at the Profile class:
| | import java.util.HashMap; |
| | import java.util.Map; |
| | import static iloveyouboss.Weight.REQUIRED; |
| | |
| | public class Profile { |
| | private final Map<String,Answer> answers = new HashMap<>(); |
| | private final String name; |
| | private int score; |
| | |
| | public Profile(String name) { this.name = name; } |
| | |
| | public void add(Answer... newAnswers) { |
| | for (var answer: newAnswers) |
| | answers.put(answer.questionText(), answer); |
| | } |
| | |
| | public boolean matches(Criteria criteria) { |
| | calculateScore(criteria); |
| | |
| | if (anyRequiredCriteriaNotMet(criteria)) return false; |
| | |
| | return anyMatches(criteria); ... |
Read now
Unlock full access