Created
December 20, 2013 19:41
-
-
Save alcidesfp/8060217 to your computer and use it in GitHub Desktop.
Programa mascota en Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
class nomedad { | |
public static void main (String[] args) throws IOException { | |
Integer edad; | |
String strnombre; | |
BufferedReader brin; | |
int n; | |
/* Inicialización */ | |
brin = new BufferedReader(new | |
InputStreamReader(System.in)); | |
/* Comienza rutina principal */ | |
System.out.print("Hola, ¿Cuál es tu nombre? "); | |
strnombre = new String(brin.readLine()); | |
System.out.print("¿En que año naciste? "); | |
edad = new Integer(brin.readLine()); | |
n = 2006 - edad.intValue(); | |
System.out.print("Hola, "); | |
System.out.println(strnombre); | |
System.out.print("En el año 2006 tendrás "); | |
System.out.print(n); | |
System.out.println(" años"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment