-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCliente.java
48 lines (40 loc) · 1.51 KB
/
Cliente.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
import java.util.Scanner;
public class Cliente {
// Atributos da classe Cliente
public String nome;
public int idade;
public String email;
public String telefone;
// Construtor da classe Cliente
public Cliente(String nome, int idade, String email, String telefone) {
this.nome = nome;
this.idade = idade;
this.email = email;
this.telefone = telefone;
}
// Método para imprimir informações do cliente
public void imprimirInformacoes() {
System.out.println("Nome: " + nome);
System.out.println("Idade: " + idade);
System.out.println("Email: " + email);
System.out.println("Telefone: " + telefone);
}
// Método principal (main) para testar a classe
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Seu nome: ");
String nome = scanner.next();
System.out.print("Sua idade: ");
int idade = scanner.nextInt();
System.out.print("Seu email: ");
String email = scanner.next();
System.out.print("Seu telefone: ");
String telefone = scanner.next();
// Criando uma instância da classe Cliente com os dados fornecidos pelo usuário
Cliente c1 = new Cliente(nome, idade, email, telefone);
// Imprimindo informações do cliente
System.out.println("Seus Dados: ");
c1.imprimirInformacoes();
scanner.close();
}
}