-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDesafio.java
More file actions
54 lines (46 loc) · 1.83 KB
/
Desafio.java
File metadata and controls
54 lines (46 loc) · 1.83 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import java.util.Scanner;
public class Desafio {
public static void main(String[] args) {
String nome = "Renato";
String tipoConta = "Corrente";
double saldo = 4500.00;
int opcao = 0;
System.out.println("********************************");
System.out.println("\nCliente: " + nome);
System.out.println("Tipo de conta: " + tipoConta);
System.out.println("Saldo disponivel: " + saldo);
System.out.println("\n*******************************");
Scanner dados = new Scanner(System.in);
String menu = """
** Digite sua opção **
1 - Consultar saldo
2 - Transferir valor
3 - Receber valor
4 - Sair
""";
Scanner leitura = new Scanner(System.in);
while (opcao != 4) {
System.out.println(menu);
opcao = leitura.nextInt();
if (opcao == 1) {
System.out.println("Saldo atualizado: " + saldo);
} else if (opcao == 2) {
System.out.print("Digite o valor de transferencia: ");
double valor = leitura.nextDouble();
if (valor > saldo) {
System.out.println("Saldo insuficiente!");
} else {
saldo -= valor;
System.out.println("Saldo atual");
}
} else if (opcao == 3) {
System.out.println("Valor recebido: ");
double valor = leitura.nextDouble();
saldo += valor;
System.out.println("Novo saldo" + saldo);
} else if (opcao != 4) {
System.out.println("Opção invalida!");
}
}
}
}