Advertisement
nicatronTg

Untitled

Nov 20th, 2011
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.nciatronTg.shankshock.foobar;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     /**
  8.      * @param args
  9.      */
  10.     public static void main(String[] args) {
  11.         askQuestion();
  12.     }
  13.    
  14.     public static void askQuestion()
  15.     {
  16.         if (askQuestion("Do you like waffles?"))
  17.         {
  18.             System.out.println("Yay, waffles!");
  19.         } else
  20.         {
  21.             if (askQuestion("Are you sure?"))
  22.             {
  23.                 System.out.println("Fine!");
  24.             }
  25.             askQuestion();
  26.         }
  27.     }
  28.    
  29.     public static boolean askQuestion(String question)
  30.     {
  31.         Scanner input = new Scanner(System.in);
  32.         String answer;
  33.  
  34.         System.out.println(question);
  35.         answer = input.nextLine();
  36.         if (answer.equalsIgnoreCase("Yes"))
  37.         {
  38.             return true;
  39.         }
  40.         return false;
  41.     }
  42.  
  43. }
  44.  
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement