lots of exercises in java... from https://github.com/exercism/java

Allergen.java 295B

123456789101112131415161718192021
  1. enum Allergen {
  2. EGGS(1),
  3. PEANUTS(2),
  4. SHELLFISH(4),
  5. STRAWBERRIES(8),
  6. TOMATOES(16),
  7. CHOCOLATE(32),
  8. POLLEN(64),
  9. CATS(128);
  10. private final int score;
  11. Allergen(int score) {
  12. this.score = score;
  13. }
  14. int getScore() {
  15. return score;
  16. }
  17. }