forked from League-Archive/IntroToJavaWorkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMadlibsOfTheAmazon.java
More file actions
42 lines (27 loc) · 1.73 KB
/
MadlibsOfTheAmazon.java
File metadata and controls
42 lines (27 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package day3;
import javax.swing.JOptionPane;
public class MadlibsOfTheAmazon {
public static void main(String[] args) {
// Put this sentence in a pop up:
// If you find yourself having to cross a piranha-infested river, here's how to do it...
JOptionPane.showMessageDialog(null,"If you find yourself having to cross a piranha-infested river, here's how to do it... ");
// Get the user to enter an adjective
String adj=JOptionPane.showInputDialog("Please type an adjective");
// Get the user to enter a type of liquid
String liquid=JOptionPane.showInputDialog("Please name a liquid");
// Get the user to enter a body part
String body=JOptionPane.showInputDialog("Please enter a body part");
// Get the user to enter a verb
String verb=JOptionPane.showInputDialog("Please name a verb");
// Get the user to enter a place
String place=JOptionPane.showInputDialog("Please enter a place");
// Fit the user's words into this sentence, and save it in a String:
// Piranhas are more [adjective] during the day, so cross the river at
// night. Piranhas are attracted to fresh [type of liquid] and will most
// likely take a bite out of your [body part] if you [verb]. Whatever
// you do, if you have an open wound, try to find another way to get
// back to the [place]. Good luck!
JOptionPane.showMessageDialog(null, "Piranhas are more "+ adj+" during the day, so cross the river at night. Piranhas are attracted to fresh "+liquid+" and will mostlikely take a bite out of your "+body+" if you "+verb+". Whatever you do, if you have an open wound, try to find another way to getback to the "+place+". Good luck! ");
// Make a pop-up for the final story. You can use \n to go to the next line.
}
}