Difference between revisions of "Mad Lib"
From CompSciWiki
Line 4: | Line 4: | ||
|Problem= | |Problem= | ||
− | |SolutionCode=<pre>public class MadLib | + | |SolutionCode=<pre> |
+ | import javax.swing.JOptionPane; | ||
+ | |||
+ | public class MadLib | ||
{ | { | ||
− | }</pre> | + | public static void main(String []args) |
+ | { | ||
+ | String pluralNoun; | ||
+ | String country; | ||
+ | String verb; | ||
+ | String noun; | ||
+ | |||
+ | pluralNoun = JOptionPane.showInputDialog("Please enter a plural noun:"); | ||
+ | country = JOptionPane.showInputDialog("Please enter a name of a country:"); | ||
+ | verb = JOptionPane.showInputDialog("Please enter a verb:"); | ||
+ | noun = JOptionPane.showInputDialog("Please enter a noun:"); | ||
+ | |||
+ | // "The ___________ in _______ like to ____ the ____." | ||
+ | // plural noun country verb noun | ||
+ | |||
+ | System.out.println("The " + pluralNoun + " in " + country + " like to " + verb + " the " + noun + "."); | ||
+ | System.out.println("End of processing."); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </pre> | ||
Revision as of 16:17, 5 April 2010
Back to the Program-A-Day homepage
Problem |
...by studentsAn image or By Students section | |
---|---|---|
SolutionThe solution... | ||
Code |