March 2015
Intermediate to advanced
236 pages
5h 26m
English
Let’s take a look at our Profile class so far:
| iloveyouboss/23/src/iloveyouboss/Profile.java | |
| | public class Profile { |
| | private Map<String,Answer> answers = new HashMap<>(); |
| | |
| | private int score; |
| | private String name; |
| | |
| | public Profile(String name) { |
| | this.name = name; |
| | } |
| | |
| | public String getName() { |
| | return name; |
| | } |
| | |
| | public void add(Answer answer) { |
| | answers.put(answer.getQuestionText(), answer); |
| | } |
| | |
| | public boolean matches(Criteria criteria) { |
| | calculateScore(criteria); |
| | if (doesNotMeetAnyMustMatchCriterion(criteria)) |
| | return false; |
| | return anyMatches(criteria); |
| | } |
| | |
| | private boolean doesNotMeetAnyMustMatchCriterion(Criteria criteria) { |
| | |
Read now
Unlock full access