//STORY TIME else { try { Scanner fsc = new Scanner(new File("story" + option +".txt")); System.out.println(); while (fsc.hasNextLine()) { line = fsc.nextLine(); String[] parts = line.split(" "); ArrayList coolStory = new ArrayList(); //the new redone story while (line.contains("<") && line.contains(">")) { String part = "."; if (line.charAt(line.length()-1) =='.' || line.charAt. length()-1 ==',') { // for adi rnd = coolStory.add(adjs()); } else if (line.charAt(line.length()-1) ='.' || line.charAt. length()-1 ==',') { // adverb } else if (line.charAt(line.length()-1) ='.' || line.charAt.length()-1 ==',') { // singnoun } else if (line.charAt(line.length()-1) =='.' || 1line.charAt.length()-1 ==',') { // plunoun } else if (line.charAt (line.length()-1) =='.' || 1line.charAt.length()-1 ==',') { /I singverb } else if (line.charAt (line.length()-1) =='.' || 1line.charAt.length()-1 ==',') { /I pluverb } else if (line.charAt(line.length()-1) =='.' || 1line.charAt.length()-1 ==',') { // pastverb }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

mad libs with JAVA

stuck with the giant loop to connect it.

There was once a <adj> <singnoun> who <pastverb> in a <singnoun>.
Everyone in the <singnoun> was <adj> of the <adj> <singnoun>,
but no one had the <plunoun> to <pluverb>. So we <adv> <pastverb>
past the <singnoun> and <pastverb> upon the <adj> <plunoun>,
and everyone felt <adj> about their lot in life, until, of course,
the <plunoun> descended upon us like <plunoun> and took <singnoun>
from us. Rue that day! Rue it <adv>.

 

 

//STORY TIME
else {
try {
Scanner fsc = new Scanner(new File("story" + option +".txt"));
System.out.println();
while (fsc.hasNextLine()) {
line = fsc.nextLine();
String[] parts = line.split(" ");
ArrayList<String> coolStory = new ArrayList<String>(); //the new redone story
while (line.contains("<") && line.contains(">")) {
String part = "<adj>.";
if (line.charAt(line.length()-1) =='.' || line.charAt. length()-1 ==',') { // for adi
rnd = coolStory.add(adjs());
}
else if (line.charAt(line.length()-1)
='.' || line.charAt. length()-1 ==',') { // adverb
}
else if (line.charAt(line.length()-1)
='.' || line.charAt.length()-1 ==',') { // singnoun
}
else if (line.charAt(line.length()-1) =='.' || 1line.charAt.length()-1 ==',') { // plunoun
}
else if (line.charAt (line.length()-1) =='.' || 1line.charAt.length()-1 ==',') { /I singverb
}
else if (line.charAt (line.length()-1) =='.' || 1line.charAt.length()-1 ==',') { /I pluverb
}
else if (line.charAt(line.length()-1) =='.' || 1line.charAt.length()-1 ==',') { // pastverb
}
Transcribed Image Text://STORY TIME else { try { Scanner fsc = new Scanner(new File("story" + option +".txt")); System.out.println(); while (fsc.hasNextLine()) { line = fsc.nextLine(); String[] parts = line.split(" "); ArrayList<String> coolStory = new ArrayList<String>(); //the new redone story while (line.contains("<") && line.contains(">")) { String part = "<adj>."; if (line.charAt(line.length()-1) =='.' || line.charAt. length()-1 ==',') { // for adi rnd = coolStory.add(adjs()); } else if (line.charAt(line.length()-1) ='.' || line.charAt. length()-1 ==',') { // adverb } else if (line.charAt(line.length()-1) ='.' || line.charAt.length()-1 ==',') { // singnoun } else if (line.charAt(line.length()-1) =='.' || 1line.charAt.length()-1 ==',') { // plunoun } else if (line.charAt (line.length()-1) =='.' || 1line.charAt.length()-1 ==',') { /I singverb } else if (line.charAt (line.length()-1) =='.' || 1line.charAt.length()-1 ==',') { /I pluverb } else if (line.charAt(line.length()-1) =='.' || 1line.charAt.length()-1 ==',') { // pastverb }
*Untitled - Notepad
File Edit Format View Help
public ArrayList<String> readWordList(String fname) {
try {
ArrayList<String> results = new ArrayList<String>();
Scanner fsc = new Scanner(new File(fname));
for each line in the fsc you just opened:
add the line to the results list
close the fsc
return results;
} catch (Exception ex) {
return null;
}
}
in main
ArrayList<String> adjs = readwordList("adj.txt");
ArrayList<String> advs = readwordList("adv.txt");
do {
ask them what they want
if they chose i
show them the instructions
else {
try {
Scanner fsc = new Scanner(new File("story" + what they typed in + ".txt"));
for each line in the file
replace the <adj>, <adv>, etc with random words from the adjs, advs, etc. lists
} catch (Exception ex) {
say the file didn't exist
}
} while they chose not to quit
Transcribed Image Text:*Untitled - Notepad File Edit Format View Help public ArrayList<String> readWordList(String fname) { try { ArrayList<String> results = new ArrayList<String>(); Scanner fsc = new Scanner(new File(fname)); for each line in the fsc you just opened: add the line to the results list close the fsc return results; } catch (Exception ex) { return null; } } in main ArrayList<String> adjs = readwordList("adj.txt"); ArrayList<String> advs = readwordList("adv.txt"); do { ask them what they want if they chose i show them the instructions else { try { Scanner fsc = new Scanner(new File("story" + what they typed in + ".txt")); for each line in the file replace the <adj>, <adv>, etc with random words from the adjs, advs, etc. lists } catch (Exception ex) { say the file didn't exist } } while they chose not to quit
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY