From 8c114aadbc97fd693e830b0a7708690c9c824a43 Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Thu, 20 Nov 2025 04:05:38 +0000 Subject: [PATCH] [Sync Iteration] java/wizards-and-warriors-2/2 --- .../2/src/main/java/GameMaster.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 solutions/java/wizards-and-warriors-2/2/src/main/java/GameMaster.java diff --git a/solutions/java/wizards-and-warriors-2/2/src/main/java/GameMaster.java b/solutions/java/wizards-and-warriors-2/2/src/main/java/GameMaster.java new file mode 100644 index 0000000..ff1df3a --- /dev/null +++ b/solutions/java/wizards-and-warriors-2/2/src/main/java/GameMaster.java @@ -0,0 +1,39 @@ +public class GameMaster { + + // define a 'describe' method that returns a description of a Character + public String describe(Character character) + { + return "You're a level " + character.getLevel() + " " + + character.getCharacterClass() + " with " + + character.getHitPoints() + " hit points."; + } + + // define a 'describe' method that returns a description of a Destination + public String describe(Destination destination) + { + return "You've arrived at " + destination.getName() + + ", which has " + destination.getInhabitants() + " inhabitants."; + } + + // define a 'describe' method that returns a description of a TravelMethod + public String describe(TravelMethod travelMethod) + { + if(travelMethod == TravelMethod.WALKING) + { + return "You're traveling to your destination by walking."; + } + return "You're traveling to your destination on horseback."; + } + + // define a 'describe' method that returns a description of a Character, Destination and TravelMethod + public String describe(Character character, Destination destination, TravelMethod travelMethod) + { + return describe(character) + " " + describe(travelMethod) + " " + describe(destination); + } + + // define a 'describe' method that returns a description of a Character and Destination + public String describe(Character character, Destination destination) + { + return describe(character, destination,TravelMethod.WALKING); + } +}