RadicalTruthHF

aClock prompts

Jun 10th, 2012
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.53 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class oneClass {
  3.     public static void main(String args[]){
  4.        
  5.         //gets hour
  6.         System.out.println("Please enter the HOUR of the time you want " +
  7.                 "the alarm to ring:");
  8.         Scanner getHour = new Scanner(System.in);
  9.         int hour = getHour.nextInt();
  10.        
  11.         //confirms hour
  12.         System.out.println("You entered the hour " +hour+ ". Is this " +
  13.                 "correct? Please enter \"yes\" or \"no\".");
  14.         Scanner confirm = new Scanner(System.in);
  15.         String confirmation = confirm.nextLine();
  16.        
  17.         //if confirmation for hour succeeds, gets minute
  18.     if(confirmation.equals("yes")){
  19.         System.out.println("Please enter the MINUTE of the HOUR of the " +
  20.                 "time you want:");
  21.         Scanner getMinute = new Scanner(System.in);
  22.         int minute = getMinute.nextInt();
  23.            
  24.         //prints time for second confirmation
  25.         System.out.println("Your selected time to play the alarm is " +
  26.                 hour + ":" + minute + ". Is this correct? Please enter " +
  27.                 "\"yes\" or \"no\". ");
  28.     }else if(confirmation.equals("no")){
  29.         System.out.println("Please run the program again.");
  30.     }else{
  31.         System.out.println("Your input was not understood. Please run" +
  32.                 "the program again.");
  33.     }
  34.        
  35.         //second confirmation
  36.         Scanner finalConfirm = new Scanner(System.in);
  37.         String finalConfirmation = finalConfirm.nextLine();
  38.        
  39.         //if second confirmation succeeds, find mp3.
  40.     if(finalConfirmation.equals("yes")){
  41.         System.out.println("Okay. Now please enter the path of the file" +
  42.                 "you wish to play at the selected time.");
  43.        
  44.     }
  45.        
  46.         }
  47.        
  48.     }
Advertisement
Add Comment
Please, Sign In to add comment