reference:
https://www.youtube.com/watch?v=uNfdq0GqstA
one can only assume what the actual code looks like, but here is mine:
pirate speech implementation:
use example:
AXLPirate p1 = new AXLPirate();
System.out.println(p1.decorate("hello there friend how are you"));
output:
arr ahoy there matey how are ye
https://www.youtube.com/watch?v=uNfdq0GqstA
one can only assume what the actual code looks like, but here is mine:
Code:
package AXJava;
import java.util.Hashtable;
public class AXLSpeechModifier extends AXLHousing{
public Hashtable<String,String> dic;
public AXLSpeechModifier(Hashtable<String, String> dic) {
this.dic = dic;
}
@Override
public String decorate(String str1) {
String result = "";
String[] words = str1.split("\\s+");
for (int i = 0; i < words.length; i++) {
words[i] = dic.getOrDefault(words[i], words[i]);
result = result + " " + words[i];
}
return result;
}
}
pirate speech implementation:
Code: package AXJava; |
AXLPirate p1 = new AXLPirate();
System.out.println(p1.decorate("hello there friend how are you"));
output:
arr ahoy there matey how are ye