Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class oneClass {
- public static void main(String args[]){
- //gets hour
- System.out.println("Please enter the HOUR of the time you want " +
- "the alarm to ring:");
- Scanner getHour = new Scanner(System.in);
- int hour = getHour.nextInt();
- //confirms hour
- System.out.println("You entered the hour " +hour+ ". Is this " +
- "correct? Please enter \"yes\" or \"no\".");
- Scanner confirm = new Scanner(System.in);
- String confirmation = confirm.nextLine();
- //if confirmation for hour succeeds, gets minute
- if(confirmation.equals("yes")){
- System.out.println("Please enter the MINUTE of the HOUR of the " +
- "time you want:");
- Scanner getMinute = new Scanner(System.in);
- int minute = getMinute.nextInt();
- //prints time for second confirmation
- System.out.println("Your selected time to play the alarm is " +
- hour + ":" + minute + ". Is this correct? Please enter " +
- "\"yes\" or \"no\". ");
- }else if(confirmation.equals("no")){
- System.out.println("Please run the program again.");
- }else{
- System.out.println("Your input was not understood. Please run" +
- "the program again.");
- }
- //second confirmation
- Scanner finalConfirm = new Scanner(System.in);
- String finalConfirmation = finalConfirm.nextLine();
- //if second confirmation succeeds, find mp3.
- if(finalConfirmation.equals("yes")){
- System.out.println("Okay. Now please enter the path of the file" +
- "you wish to play at the selected time.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment