[Sync Iteration] java/wizards-and-warriors-2/1

This commit is contained in:
exercism-solutions-syncer[bot] 2026-04-22 11:06:12 +00:00 committed by GitHub
parent f80fbca12e
commit b951b01432
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,26 @@
public class GameMaster {
public String describe(Character character) {
return "You're a level " + character.getLevel() + " " + character.getCharacterClass() + " with " + character.getHitPoints() + " hit points.";
}
public String describe(Destination destination) {
return "You've arrived at " + destination.getName() + ", which has " + destination.getInhabitants() + " inhabitants.";
}
public String describe(TravelMethod travelMethod) {
if (travelMethod == TravelMethod.WALKING) {
return "You're traveling to your destination by walking.";
} else {
return "You're traveling to your destination on horseback.";
}
}
public String describe(Character character, Destination destination, TravelMethod travelMethod) {
return describe(character) + " " + describe(travelMethod) + " " + describe(destination);
}
public String describe(Character character, Destination destination) {
return describe(character) + " " + describe(TravelMethod.WALKING) + " " + describe(destination);
}
}

View File

@ -0,0 +1,4 @@
public enum TravelMethod {
WALKING,
HORSEBACK
}