MrDoyle

Age in Five Years

Sep 18th, 2020
611
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         System.out.print("Please enter your name: ");
  7.         Scanner input = new Scanner (System.in);
  8.         String name = input.nextLine();
  9.  
  10.         System.out.print("Hey " + name + " How old are you? ");
  11.         int age = input.nextInt();
  12.  
  13.         System.out.println("Did you know that in five years you will be " + (age + 5) + " years old?");
  14.         System.out.println("And five years ago you were " + (age - 5) + "! Imagine that!");
  15.  
  16.     }
  17. }
RAW Paste Data