Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Sean Luava
- * 4/23/16
- */
- import javax.swing.*;
- public class Button
- {
- private int bat;
- private boolean car;
- private boolean frk;
- public Button(int b, String[] lit)
- {
- bat = b;
- car = false;
- frk = false;
- for(int aa = 0; aa < lit.length; aa++)
- {
- if(lit[aa].equals("car"))
- car = true;
- if(lit[aa].equals("frk"))
- frk = true;
- }
- }
- public void run()
- {
- String color = JOptionPane.showInputDialog("Enter color of the button:");
- color = color.toLowerCase();
- String word = JOptionPane.showInputDialog("Enter word on the button:");
- word = word.toLowerCase();
- boolean hold = false;
- String strip = "";
- if((color.equals("blue")) && (word.equals("abort")))
- {
- strip = JOptionPane.showInputDialog("Hold down the button and enter the color of the strip:");
- hold = true;
- }
- else if((bat > 1) && (word.equals("detonate")))
- {
- JOptionPane.showMessageDialog(null, "Press and immediately release the button.");
- }
- else if((color.equals("white")) && (car))
- {
- strip = JOptionPane.showInputDialog("Hold down the button and enter the color of the strip:");
- hold = true;
- }
- else if((bat > 2) && (frk))
- {
- JOptionPane.showMessageDialog(null, "Press and immediately release the button.");
- }
- else if(color.equals("yellow"))
- {
- strip = JOptionPane.showInputDialog("Hold down the button and enter the color of the strip:");
- hold = true;
- }
- else if((color.equals("red")) && (word.equals("hold")))
- {
- JOptionPane.showMessageDialog(null, "Press and immediately release the button.");
- }
- else
- {
- strip = JOptionPane.showInputDialog("Hold down the button and enter the color of the strip:");
- hold = true;
- }
- if(hold)
- {
- strip = strip.toLowerCase();
- holding(strip);
- }
- }
- private void holding(String s)
- {
- int digit = 1;
- switch(s)
- {
- case "blue":
- digit = 4;
- break;
- case "yellow":
- digit = 5;
- break;
- }
- JOptionPane.showMessageDialog(null, "Release when the countdown timer has a " + digit + " in any position.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement