forked from shyamsingh15/HACKTOBERFEST2K20
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cadastro.java
61 lines (51 loc) · 1.77 KB
/
cadastro.java
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package cadastro;
import java.text.DecimalFormat;
import java.util.Scanner;
/**
*
* @author wlucca
* @version 1.0
*/
public class Cadastro
{
public static String nome = "";
public static String sobreNome = "";
public static int idade = 0;
public static boolean fumante = false;
public static int opcao = 0;
public static double renda = 0.00;
public static DecimalFormat df = new DecimalFormat("0.00");
public static Scanner entrada = new Scanner(System.in);
public static void main(String[] args)
{
System.out.println("Iniciando o programa de cadastro!");
System.out.print("Digite o seu primeiro nome: ");
nome = entrada.nextLine();
System.out.print("Digite o seu ultimo nome: ");
sobreNome = entrada.nextLine();
System.out.print("Digite a sua idade: ");
idade = entrada.nextInt();
System.out.print("Digite 1 para fumante ou 0 para nao fumante: ");
opcao = entrada.nextInt();
if (opcao == 1)
{
fumante = true;
}
else
{
fumante = false;
}
System.out.print("Digite a sua renda (use , para separar a parte decimal: ");
renda = entrada.nextDouble();
System.out.println("");
System.out.println("");
// Exibindo os dados:
System.out.println("Dados Cadastrados...");
System.out.println("Nome Completo: " + nome + " " + sobreNome);
System.out.println("Idade: " + idade);
System.out.println("Fumante: " + fumante);
System.out.println("Digite sua renda mensal: " + df.format(renda).toString());
System.out.println("");
System.out.println("Fim do programa!");
}
}