forked from League-Archive/IntroToJavaWorkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCandyCrush.java
More file actions
20 lines (16 loc) · 755 Bytes
/
CandyCrush.java
File metadata and controls
20 lines (16 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//Copyright Wintriss Technical Schools 2014
import javax.swing.JOptionPane;
public class CandyCrush
{
public static void main(String[] args)
{
// 1. Using a pop-up, ask the user who they don't like
String hate = JOptionPane.showInputDialog("Please enter the name of someone who you dislike");
// 2. Change the next line so that the pop-up will tell them they have a crush on that person
JOptionPane.showMessageDialog(null, "You totally have a crush on " + hate);
// 3. Ask the user for the name of their best friend
String bf = JOptionPane.showInputDialog("Please enter the name of your best friend");
// 4. Tell them their best friend is as sweet as candy
JOptionPane.showMessageDialog(null, bf + " is as sweet as candy.");
}
}