-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAboutMe.java
More file actions
35 lines (27 loc) · 1.08 KB
/
AboutMe.java
File metadata and controls
35 lines (27 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.util.InputMismatchException;
import java.util.Locale;
import java.util.Scanner;
public class AboutMe {
public static void main(String[] args) {
try{
//criando o objeto scanner
Scanner scanner = new Scanner(System.in).useLocale(Locale.US);
System.out.println("Digite seu nome");
String nome = scanner.next();
System.out.println("Digite seu sobrenome");
String sobrenome = scanner.next();
System.out.println("Digite sua idade");
int idade = scanner.nextInt();
System.out.println("Digite sua altura");
double altura = scanner.nextDouble();
//imprimindo os dados obtidos pelo usuario
System.out.println("Ola, me chamo " + nome + " " + sobrenome);
System.out.println("Tenho " + idade + " anos ");
System.out.println("Minha altura é " + altura + "cm ");
scanner.close();
}
catch(InputMismatchException e) {
System.out.println("Campos idade/altura em formato incorreto");
}
}
}