Question: import java.util. * ; public class MadLib extends ConsoleProgram { / / Private constants private static final char PLACEHOLDER _ START _ CHARACTER = '
import java.util.;
public class MadLib extends ConsoleProgram
Private constants
private static final char PLACEHOLDERSTARTCHARACTER ;
private static final char PLACEHOLDERENDCHARACTER ;
File reader to get the template from the "madlib.txt file
private MadLibFileReader madLibFileReader new MadLibFileReader;
public void run
Gets the contents of the file "madlib.txt as a String
This will be the template for our Mad Lib Story
String template madLibFileReader.getMadLibTemplate;
ArrayList placeholders getPlaceholderstemplate;
if placeholders null
for String placeholder : placeholders
System.out.printlnplaceholder;
else
System.out.printlnError: Malformed template!";
private ArrayList getPlaceholdersString template
String template "The AdjectiveNoun jumped over the AdjectiveNoun;
ArrayList placeholders getPlaceholderstemplate;
forint i ; i placeholders.size; i
System.out.printlnplaceholdersgeti;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
