SlideShare a Scribd company logo
Mad Libs is a children's game in which they provide a few words that are then incorporated into
a silly story. The game helps children understand different parts of speech because they are asked
to provide specific types of words. For example, you might ask a child for a noun, another noun,
an adjective, and a past-tense verb. The child might reply with such answers as table, book, silly,
and studied. The newly created Mad Lib might be: Mary had a little table Its book was silly as
snow And everywhere that Mary studied The table was sure to go. Create a Mad Libs program
that asks the user to provide at least four or five words, and then create and display a short story
or nursery rhyme that uses them. Save the file as MadLib.java.
Solution
MadLib.java
import java.io.*;
class MadLib {
private static void intro()
{
String msg = "This is a Mad-Lib game. I will prompt " +
"you for five words. ";
System.out.print(msg);
}
private static String getInput(String msg) throws IOException
{
BufferedReader stdin;
stdin = new BufferedReader(new InputStreamReader(System.in));
System.out.print(msg);
return stdin.readLine();
}
private static void printOutput (String noun1, String adverb, String noun2, String pronoun,
String adj)
{
String output = " Three blind " + noun1 + ",  Three blind " + noun1 + ",  see " +
adverb +
" they run!" + " see " + adverb + " they run! They all ran after the farmer's " +
noun2 +
" Who cut off their tails, With a carving knife. Did you ever see " +
pronoun + " a thing in your life, As three " + adj + " mice.";
System.out.println(output);
}
public static void main(String[] args) throws IOException
{
intro();
String noun1 = getInput("Enter a noun : ");
String adverb = getInput("Enter a adverb : ");
String noun2 = getInput("Enter a another noun : ");
String pronoun = getInput("Enter a pronoun : ");
String adj = getInput("Enter an adjective : ");
printOutput(noun1, adverb, noun2, pronoun, adj);
}
}
Output:
This is a Mad-Lib game. I will prompt you for five words.
Enter a noun : mice
Enter a adverb : how
Enter a another noun : wife
Enter a pronoun : such
Enter an adjective : blind
Three blind mice,
Three blind mice,
see how they run!
see how they run!
They all ran after the farmer's wife
Who cut off their tails,
With a carving knife.
Did you ever see such a thing in your life,
As three blind mice.

More Related Content

More from ajaysinghjpr

Let Z be a standard normal random variable. Find numbers alpha such .pdf
 Let Z be a standard normal random variable. Find numbers alpha  such .pdf Let Z be a standard normal random variable. Find numbers alpha  such .pdf
Let Z be a standard normal random variable. Find numbers alpha such .pdf
ajaysinghjpr
 
Name two ways in which the profit motive improves the managerial .pdf
 Name two ways in which the profit motive improves the managerial .pdf Name two ways in which the profit motive improves the managerial .pdf
Name two ways in which the profit motive improves the managerial .pdf
ajaysinghjpr
 
Name a static device that can genera reactive Power. SolutionSt.pdf
 Name a static device that can genera reactive Power. SolutionSt.pdf Name a static device that can genera reactive Power. SolutionSt.pdf
Name a static device that can genera reactive Power. SolutionSt.pdf
ajaysinghjpr
 
Name the proper aliquot part of Section 2 Section 2, Township 7 South.pdf
 Name the proper aliquot part of Section 2 Section 2, Township 7 South.pdf Name the proper aliquot part of Section 2 Section 2, Township 7 South.pdf
Name the proper aliquot part of Section 2 Section 2, Township 7 South.pdf
ajaysinghjpr
 
Name a line parallel to AB containing point G. Name a line skew to .pdf
 Name a line parallel to AB  containing point G.  Name a line skew to .pdf Name a line parallel to AB  containing point G.  Name a line skew to .pdf
Name a line parallel to AB containing point G. Name a line skew to .pdf
ajaysinghjpr
 
Multiple Choice Question 192 A journal on O contains only ass.pdf
 Multiple Choice Question 192 A journal on O contains only ass.pdf Multiple Choice Question 192 A journal on O contains only ass.pdf
Multiple Choice Question 192 A journal on O contains only ass.pdf
ajaysinghjpr
 
Multiple regression analysis is applied when analyzing the relati.pdf
 Multiple regression analysis is applied when analyzing the relati.pdf Multiple regression analysis is applied when analyzing the relati.pdf
Multiple regression analysis is applied when analyzing the relati.pdf
ajaysinghjpr
 
Multiple Access Techniques Compare and contrast only two performance.pdf
 Multiple Access Techniques Compare and contrast only two performance.pdf Multiple Access Techniques Compare and contrast only two performance.pdf
Multiple Access Techniques Compare and contrast only two performance.pdf
ajaysinghjpr
 
mitchel. Inc. has a debt ratio of 33 percent and ROA = - 27 percent. .pdf
 mitchel. Inc. has a debt ratio of 33 percent and ROA = - 27 percent. .pdf mitchel. Inc. has a debt ratio of 33 percent and ROA = - 27 percent. .pdf
mitchel. Inc. has a debt ratio of 33 percent and ROA = - 27 percent. .pdf
ajaysinghjpr
 
mgt101.. please answer.Solution25.Efficiency Efficiency.pdf
 mgt101.. please answer.Solution25.Efficiency  Efficiency.pdf mgt101.. please answer.Solution25.Efficiency  Efficiency.pdf
mgt101.. please answer.Solution25.Efficiency Efficiency.pdf
ajaysinghjpr
 
Mention in DETAIL the differences between the ARM LPC2119 and the 805.pdf
 Mention in DETAIL the differences between the ARM LPC2119 and the 805.pdf Mention in DETAIL the differences between the ARM LPC2119 and the 805.pdf
Mention in DETAIL the differences between the ARM LPC2119 and the 805.pdf
ajaysinghjpr
 
Mechanics of solids Mechanics of solidsSolutionMechanics .pdf
 Mechanics of solids Mechanics of solidsSolutionMechanics .pdf Mechanics of solids Mechanics of solidsSolutionMechanics .pdf
Mechanics of solids Mechanics of solidsSolutionMechanics .pdf
ajaysinghjpr
 
Let z1 and z2 be distinct complex numbers. Show that the locus of poi.pdf
 Let z1 and z2 be distinct complex numbers. Show that the locus of poi.pdf Let z1 and z2 be distinct complex numbers. Show that the locus of poi.pdf
Let z1 and z2 be distinct complex numbers. Show that the locus of poi.pdf
ajaysinghjpr
 
Mary Tiles and Hans Oberdiek Conflicting Visions of Technology, W.pdf
 Mary Tiles and Hans Oberdiek Conflicting Visions of Technology, W.pdf Mary Tiles and Hans Oberdiek Conflicting Visions of Technology, W.pdf
Mary Tiles and Hans Oberdiek Conflicting Visions of Technology, W.pdf
ajaysinghjpr
 
Martin Heidegger, part 1 The Question Concerning Technology, p. .pdf
 Martin Heidegger, part 1  The Question Concerning Technology, p. .pdf Martin Heidegger, part 1  The Question Concerning Technology, p. .pdf
Martin Heidegger, part 1 The Question Concerning Technology, p. .pdf
ajaysinghjpr
 
Let Y1 and Y2 be independent and identically distributed with a unifo.pdf
 Let Y1 and Y2 be independent and identically distributed with a unifo.pdf Let Y1 and Y2 be independent and identically distributed with a unifo.pdf
Let Y1 and Y2 be independent and identically distributed with a unifo.pdf
ajaysinghjpr
 
Management Accounting information is best described as Providing a s.pdf
 Management Accounting information is best described as Providing a s.pdf Management Accounting information is best described as Providing a s.pdf
Management Accounting information is best described as Providing a s.pdf
ajaysinghjpr
 

More from ajaysinghjpr (17)

Let Z be a standard normal random variable. Find numbers alpha such .pdf
 Let Z be a standard normal random variable. Find numbers alpha  such .pdf Let Z be a standard normal random variable. Find numbers alpha  such .pdf
Let Z be a standard normal random variable. Find numbers alpha such .pdf
 
Name two ways in which the profit motive improves the managerial .pdf
 Name two ways in which the profit motive improves the managerial .pdf Name two ways in which the profit motive improves the managerial .pdf
Name two ways in which the profit motive improves the managerial .pdf
 
Name a static device that can genera reactive Power. SolutionSt.pdf
 Name a static device that can genera reactive Power. SolutionSt.pdf Name a static device that can genera reactive Power. SolutionSt.pdf
Name a static device that can genera reactive Power. SolutionSt.pdf
 
Name the proper aliquot part of Section 2 Section 2, Township 7 South.pdf
 Name the proper aliquot part of Section 2 Section 2, Township 7 South.pdf Name the proper aliquot part of Section 2 Section 2, Township 7 South.pdf
Name the proper aliquot part of Section 2 Section 2, Township 7 South.pdf
 
Name a line parallel to AB containing point G. Name a line skew to .pdf
 Name a line parallel to AB  containing point G.  Name a line skew to .pdf Name a line parallel to AB  containing point G.  Name a line skew to .pdf
Name a line parallel to AB containing point G. Name a line skew to .pdf
 
Multiple Choice Question 192 A journal on O contains only ass.pdf
 Multiple Choice Question 192 A journal on O contains only ass.pdf Multiple Choice Question 192 A journal on O contains only ass.pdf
Multiple Choice Question 192 A journal on O contains only ass.pdf
 
Multiple regression analysis is applied when analyzing the relati.pdf
 Multiple regression analysis is applied when analyzing the relati.pdf Multiple regression analysis is applied when analyzing the relati.pdf
Multiple regression analysis is applied when analyzing the relati.pdf
 
Multiple Access Techniques Compare and contrast only two performance.pdf
 Multiple Access Techniques Compare and contrast only two performance.pdf Multiple Access Techniques Compare and contrast only two performance.pdf
Multiple Access Techniques Compare and contrast only two performance.pdf
 
mitchel. Inc. has a debt ratio of 33 percent and ROA = - 27 percent. .pdf
 mitchel. Inc. has a debt ratio of 33 percent and ROA = - 27 percent. .pdf mitchel. Inc. has a debt ratio of 33 percent and ROA = - 27 percent. .pdf
mitchel. Inc. has a debt ratio of 33 percent and ROA = - 27 percent. .pdf
 
mgt101.. please answer.Solution25.Efficiency Efficiency.pdf
 mgt101.. please answer.Solution25.Efficiency  Efficiency.pdf mgt101.. please answer.Solution25.Efficiency  Efficiency.pdf
mgt101.. please answer.Solution25.Efficiency Efficiency.pdf
 
Mention in DETAIL the differences between the ARM LPC2119 and the 805.pdf
 Mention in DETAIL the differences between the ARM LPC2119 and the 805.pdf Mention in DETAIL the differences between the ARM LPC2119 and the 805.pdf
Mention in DETAIL the differences between the ARM LPC2119 and the 805.pdf
 
Mechanics of solids Mechanics of solidsSolutionMechanics .pdf
 Mechanics of solids Mechanics of solidsSolutionMechanics .pdf Mechanics of solids Mechanics of solidsSolutionMechanics .pdf
Mechanics of solids Mechanics of solidsSolutionMechanics .pdf
 
Let z1 and z2 be distinct complex numbers. Show that the locus of poi.pdf
 Let z1 and z2 be distinct complex numbers. Show that the locus of poi.pdf Let z1 and z2 be distinct complex numbers. Show that the locus of poi.pdf
Let z1 and z2 be distinct complex numbers. Show that the locus of poi.pdf
 
Mary Tiles and Hans Oberdiek Conflicting Visions of Technology, W.pdf
 Mary Tiles and Hans Oberdiek Conflicting Visions of Technology, W.pdf Mary Tiles and Hans Oberdiek Conflicting Visions of Technology, W.pdf
Mary Tiles and Hans Oberdiek Conflicting Visions of Technology, W.pdf
 
Martin Heidegger, part 1 The Question Concerning Technology, p. .pdf
 Martin Heidegger, part 1  The Question Concerning Technology, p. .pdf Martin Heidegger, part 1  The Question Concerning Technology, p. .pdf
Martin Heidegger, part 1 The Question Concerning Technology, p. .pdf
 
Let Y1 and Y2 be independent and identically distributed with a unifo.pdf
 Let Y1 and Y2 be independent and identically distributed with a unifo.pdf Let Y1 and Y2 be independent and identically distributed with a unifo.pdf
Let Y1 and Y2 be independent and identically distributed with a unifo.pdf
 
Management Accounting information is best described as Providing a s.pdf
 Management Accounting information is best described as Providing a s.pdf Management Accounting information is best described as Providing a s.pdf
Management Accounting information is best described as Providing a s.pdf
 

Recently uploaded

Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 

Recently uploaded (20)

Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 

Mad Libs is a childrens game in which they provide a few words that.pdf

  • 1. Mad Libs is a children's game in which they provide a few words that are then incorporated into a silly story. The game helps children understand different parts of speech because they are asked to provide specific types of words. For example, you might ask a child for a noun, another noun, an adjective, and a past-tense verb. The child might reply with such answers as table, book, silly, and studied. The newly created Mad Lib might be: Mary had a little table Its book was silly as snow And everywhere that Mary studied The table was sure to go. Create a Mad Libs program that asks the user to provide at least four or five words, and then create and display a short story or nursery rhyme that uses them. Save the file as MadLib.java. Solution MadLib.java import java.io.*; class MadLib { private static void intro() { String msg = "This is a Mad-Lib game. I will prompt " + "you for five words. "; System.out.print(msg); } private static String getInput(String msg) throws IOException { BufferedReader stdin; stdin = new BufferedReader(new InputStreamReader(System.in)); System.out.print(msg); return stdin.readLine(); } private static void printOutput (String noun1, String adverb, String noun2, String pronoun, String adj) { String output = " Three blind " + noun1 + ", Three blind " + noun1 + ", see " + adverb + " they run!" + " see " + adverb + " they run! They all ran after the farmer's " + noun2 + " Who cut off their tails, With a carving knife. Did you ever see " + pronoun + " a thing in your life, As three " + adj + " mice.";
  • 2. System.out.println(output); } public static void main(String[] args) throws IOException { intro(); String noun1 = getInput("Enter a noun : "); String adverb = getInput("Enter a adverb : "); String noun2 = getInput("Enter a another noun : "); String pronoun = getInput("Enter a pronoun : "); String adj = getInput("Enter an adjective : "); printOutput(noun1, adverb, noun2, pronoun, adj); } } Output: This is a Mad-Lib game. I will prompt you for five words. Enter a noun : mice Enter a adverb : how Enter a another noun : wife Enter a pronoun : such Enter an adjective : blind Three blind mice, Three blind mice, see how they run! see how they run! They all ran after the farmer's wife Who cut off their tails, With a carving knife. Did you ever see such a thing in your life, As three blind mice.