r/programmingbydoing • u/sCderb429 • Apr 14 '15
Age in five years
I was able to do the majority of the exercise, but I can't figure out how to actually add and subtract from the intergers
import java.lang.String; import java.lang.System; import java.util.Scanner;
public class keyboard5 { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in);
String name;
int age;
System.out.print("Hello. What is your name?");
name = keyboard.next();
System.out.print("Hi," + name + ". How old are you");
age = keyboard.nextInt();
System.out.print("Did you know that in five years you will be " + age+ " years old.");
System.out.print(" And five years ago you were " + age + "! Imagine that!");
}}
5
Upvotes
View all comments
Show parent comment
2
u/holyteach Apr 15 '15
If you're this much of a beginner, you probably shouldn't be using an IDE. It wants to do things for you that you need to learn for yourself.