Teste Diagnostico

 avatar
unknown
java
2 years ago
838 B
6
Indexable
package me.petereo;

import java.util.Random;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Hello there, would you be so kind as to provide me with a number? Any number at all! ");
        
        double userInput = scanner.nextDouble();
        System.out.println("Hmm... Interesting...");
        
        try{
            // Waits for a pseudo random amount in between 500 and 3000ms
            Random r = new Random();
            Thread.sleep(r.nextInt(2500) + 500);

            System.out.println("It shall be: " + (userInput*2));
        }catch(InterruptedException e) {
            System.out.println("My thoughts were interrupted, here you go: " + (userInput*2));
        }
    }
}
Editor is loading...