-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
57 lines (49 loc) · 1.94 KB
/
Main.java
File metadata and controls
57 lines (49 loc) · 1.94 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
55
56
57
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// inicializar dados do cliente
String nome = "Jacqueline Oliveira";
String tipoConta = "Corrente";
double saldo = 2500;
int op = 0;
Scanner leitura = new Scanner(System.in);
System.out.println("*******************************");
System.out.println("\nNome: " + nome);
System.out.println("Tipo conta: " +tipoConta);
System.out.println("Saldo inicial: "+ saldo);
System.out.println("\n*******************************");
System.out.println("\n");
//menu de opções
String menu = """
Operações:
1- Consultar saldos.
2- Receber valor.
3- Transferir valor.
4- Sair.
Digite a opção desejada:
""";
while (op != 4) {
System.out.println(menu);
op = leitura.nextInt();
if (op == 1){
System.out.println("O valor atual do saldo é: " + saldo);
} else if (op == 2) {
System.out.println("Informe o valor a receber: ");
double valor = leitura.nextDouble();
saldo += valor;
System.out.println("Saldo atualizado: "+ saldo);
} else if(op == 3) {
System.out.println("Informe o valor que deseja transferir: ");
double valor = leitura.nextDouble();
if (valor > saldo) {
System.out.println("Não há saldo suficiente para fazer essa transferência.");
} else {
saldo -= valor;
System.out.println("Saldo atualizado: " + saldo);
}
} else if (op != 4) {
System.out.println("Opção inválida.");
}
}
}
}