Compare commits
5 Commits
36b01a3976
...
6d2f99436a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d2f99436a | ||
|
|
4b20447c7a | ||
|
|
cd5ebb6faa | ||
|
|
d9acbccdd9 | ||
|
|
c813eb0740 |
@@ -1 +1,6 @@
|
|||||||
Tiago Silva,195572,913538232,250422@epvc.pt,228389992,500.0
|
Tiago Silva,195572,913538232,250422@epvc.pt,228389992,500.0
|
||||||
|
manel,779820,987654321,manel@epvc.pt,123456789,60.0
|
||||||
|
Tony Eric Wilson,720726,967761691,tony@mail.pt,228389992,1000.0
|
||||||
|
Eric,390298,938624267,e@e.pt,228389992,654803.0
|
||||||
|
Tomás,507712,967761691,tiago@mail.com,228389992,385.0
|
||||||
|
Wilson,755137,909876543,ftyj@eptp.com,228389992,700.0
|
||||||
|
|||||||
11
faturas.txt
Normal file
11
faturas.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
ouwefh, 934384261, rua alexandre de morais, 38, 25/11/2012, Cinquenta euros, valor, ilhbv
|
||||||
|
Vendeiro, 913538232, Póvoa de Varzim, 25/05/2023, Duzentos e cinquenta e seis euros, valor, Eric
|
||||||
|
Vendeiro, 946823523, Póvoa de Varzim, 24/07/2023, Trezentos e cinquenta e quatro euros, valor, Eric
|
||||||
|
Vendeiro, 940736325, Vila do Conde, 23/07/2023, Quatrocentos e vinte e cinco euros e cinquenta e seis cêntimos, valor, Eric
|
||||||
|
tiago, 912345678, Porto, 23/07/2023, Cento e vinte e três euros e quarenta e cinco cêntimos, valor, Eric
|
||||||
|
Vendeiro, 987654321, Porto, 11/07/2023, Quatrocentos euros e dois cêntimos, valor, Wilson
|
||||||
|
Vendeiro, 987654321, Porto, 23/04/2023, Duzentos euros e um cêntimo, valor, Wilson
|
||||||
|
vendeiro, 987654321, Porto, 23/07/2023, Duzentos euros, valor, Wilson
|
||||||
|
e, 987654321, e, 23/07/2023, Duzentos euros e dois cêntimos, valor, Wilson
|
||||||
|
e, 987654321, e, , Duzentos euros, valor, e
|
||||||
|
e, 987654321, e, 23/07/2023, Duzentos euros e dois cêntimos, valor, Wilson
|
||||||
@@ -27,15 +27,14 @@ public class Mavenproject25 {
|
|||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
System.out.println("══════════════════════════════════════\n" +
|
System.out.println("══════════════════════════════════════\n" +
|
||||||
" Seleciona uma das opções\n" +
|
" Seleciona uma das opções\n" +
|
||||||
"══════════════════════════════════════\n" +
|
"══════════════════════════════════════\n" +
|
||||||
" [1] Criar conta\n" +
|
" [1] Criar conta\n" +
|
||||||
" [2] Login\n" +
|
" [2] Login\n" +
|
||||||
" [3] Sair\n" +
|
" [3] Sair\n" +
|
||||||
"══════════════════════════════════════"
|
"══════════════════════════════════════");
|
||||||
|
|
||||||
+ "\n");
|
|
||||||
int opcao = scanner.nextInt();
|
int opcao = scanner.nextInt();
|
||||||
switch (opcao) {
|
switch (opcao) {
|
||||||
case 1 -> adicionarNovoCliente();
|
case 1 -> adicionarNovoCliente();
|
||||||
@@ -72,8 +71,8 @@ public class Mavenproject25 {
|
|||||||
System.out.println("ID: " + idTitular[i]);
|
System.out.println("ID: " + idTitular[i]);
|
||||||
System.out.println("Telefone: " + numeroTel[i]);
|
System.out.println("Telefone: " + numeroTel[i]);
|
||||||
System.out.println("Email: " + email[i]);
|
System.out.println("Email: " + email[i]);
|
||||||
System.out.println("NIF: " + NIF[i] + "\n");
|
System.out.println("NIF: " + NIF[i]);
|
||||||
System.out.println("Saldo:" + saldoTxt[i]);
|
System.out.println("Saldo:" + saldoTxt[i] +"\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,20 +255,22 @@ private static void menuClienteLogado(String[] dadosCliente) {
|
|||||||
double saldo = Double.parseDouble(dadosCliente[5]);
|
double saldo = Double.parseDouble(dadosCliente[5]);
|
||||||
|
|
||||||
while (!sair) {
|
while (!sair) {
|
||||||
System.out.printf("\n"
|
System.out.printf(
|
||||||
+ "╔════════════════════════════════════════╗\n"
|
"\n" +
|
||||||
+ "║ BEM-VINDO ║\n"
|
"╔═════════════════════════════════════════╗\n" +
|
||||||
+ "╠════════════════════════════════════════╣\n"
|
"║ BEM-VINDO ║\n" +
|
||||||
+ "║ SEU SALDO: ║\n"
|
"╠═════════════════════════════════════════╣\n" +
|
||||||
+ "╠════════════════════════════════════════╣\n"
|
"║ %-39s ║\n" +
|
||||||
+ "║ ▸ 1 Consultar meus dados ║\n"
|
"╠═════════════════════════════════════════╣\n" +
|
||||||
+ "║ ▸ 2 Transferir dinheiro ║\n"
|
"║ ▸ 1 Consultar meus dados ║\n" +
|
||||||
+ "║ ▸ 3 Depositar dinheiro ║\n"
|
"║ ▸ 2 Transferir ║\n" +
|
||||||
+ "║ ▸ 4 Levantar dinheiro ║\n"
|
"║ ▸ 3 Depositar ║\n" +
|
||||||
+ "║ ▸ 5 Cheque ║\n"
|
"║ ▸ 4 Levantar dinheiro ║\n" +
|
||||||
+ "║ ▸ 6 Sair ║\n"
|
"║ ▸ 5 Cheque ║\n" +
|
||||||
+ "╚════════════════════════════════════════╝\n",
|
"║ ▸ 6 Cambio ║\n" +
|
||||||
dadosCliente[0], saldo);
|
"║ ▸ 7 Sair ║\n" +
|
||||||
|
"╚═════════════════════════════════════════╝\n",
|
||||||
|
"SEU SALDO: " + saldo);
|
||||||
|
|
||||||
int opcao = scanner.nextInt();
|
int opcao = scanner.nextInt();
|
||||||
|
|
||||||
@@ -278,7 +279,7 @@ private static void menuClienteLogado(String[] dadosCliente) {
|
|||||||
mostrarDadosCliente(dadosCliente);
|
mostrarDadosCliente(dadosCliente);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
saldo = transferirDinheiro(dadosCliente[1], saldo);
|
saldo = transferirDinheiro(dadosCliente[2], saldo);
|
||||||
atualizarSaldoCliente(dadosCliente[1], saldo);
|
atualizarSaldoCliente(dadosCliente[1], saldo);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@@ -290,7 +291,9 @@ private static void menuClienteLogado(String[] dadosCliente) {
|
|||||||
atualizarSaldoCliente(dadosCliente[1], saldo);
|
atualizarSaldoCliente(dadosCliente[1], saldo);
|
||||||
break;
|
break;
|
||||||
case 5 : cheque();
|
case 5 : cheque();
|
||||||
case 6:
|
break;
|
||||||
|
case 6 : moeda();
|
||||||
|
case 7:
|
||||||
sair = true;
|
sair = true;
|
||||||
System.out.println("A sair da conta...");
|
System.out.println("A sair da conta...");
|
||||||
break;
|
break;
|
||||||
@@ -301,24 +304,24 @@ private static void menuClienteLogado(String[] dadosCliente) {
|
|||||||
}
|
}
|
||||||
private static void mostrarDadosCliente(String[] dados) {
|
private static void mostrarDadosCliente(String[] dados) {
|
||||||
System.out.println("\n╔════════════════════════════════════════╗");
|
System.out.println("\n╔════════════════════════════════════════╗");
|
||||||
System.out.println("║ SEUS DADOS PESSOAIS ║");
|
System.out.println ("║ SEUS DADOS PESSOAIS ║");
|
||||||
System.out.println("╠════════════════════════════════════════╣");
|
System.out.println ("╠════════════════════════════════════════╣");
|
||||||
System.out.printf("║ Nome: ║\n", dados[0]);
|
System.out.printf ("║ %-38s ║\n", "Nome: " + dados[0]);
|
||||||
System.out.printf("║ ID: ║\n", dados[1]);
|
System.out.printf ("║ %-38s ║\n", "ID: " + dados[1]);
|
||||||
System.out.printf("║ Telefone: ║\n", dados[2]);
|
System.out.printf ("║ %-38s ║\n", "Telefone: " + dados[2]);
|
||||||
System.out.printf("║ Email: ║\n", dados[3]);
|
System.out.printf ("║ %-38s ║\n", "Email: " + dados[3]);
|
||||||
System.out.printf("║ NIF: ║\n", dados[4]);
|
System.out.printf ("║ %-38s ║\n", "NIF: " + dados[4]);
|
||||||
System.out.printf("║ Saldo: ║\n", dados[5]);
|
System.out.printf ("║ %-38s ║\n", "Saldo: " + dados[5]);
|
||||||
System.out.println("╚════════════════════════════════════════╝\n");
|
System.out.println ("╚════════════════════════════════════════╝\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double transferirDinheiro(String idOrigem, double saldoOrigem) {
|
private static double transferirDinheiro(String telOrigem, double saldoOrigem) {
|
||||||
Scanner scanner = new Scanner(System.in);
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
|
||||||
System.out.print("Digite o ID do cliente destinatário: ");
|
System.out.print("Digite o número de Telefone do destinatário: ");
|
||||||
String idDestino = scanner.nextLine();
|
String telDestino = scanner.nextLine();
|
||||||
|
|
||||||
if (idDestino.equals(idOrigem)) {
|
if (telDestino.equals(telOrigem)) {
|
||||||
System.out.println("Não pode transferir para si mesmo!");
|
System.out.println("Não pode transferir para si mesmo!");
|
||||||
return saldoOrigem;
|
return saldoOrigem;
|
||||||
}
|
}
|
||||||
@@ -335,22 +338,11 @@ private static void menuClienteLogado(String[] dadosCliente) {
|
|||||||
System.out.println("Saldo insuficiente!");
|
System.out.println("Saldo insuficiente!");
|
||||||
return saldoOrigem;
|
return saldoOrigem;
|
||||||
}
|
}
|
||||||
|
saldoOrigem = saldoOrigem - valor;
|
||||||
|
atualizarSaldoCliente(telOrigem, saldoOrigem);
|
||||||
|
|
||||||
String[] dadosDestino = procurarClientePorId(idDestino);
|
System.out.printf("Transferência de "+valor+" realizada com sucesso!\n", valor);
|
||||||
|
|
||||||
if (dadosDestino == null) {
|
|
||||||
System.out.println("Cliente destinatário não encontrado!");
|
|
||||||
return saldoOrigem;
|
|
||||||
}
|
|
||||||
|
|
||||||
double saldoDestino = Double.parseDouble(dadosDestino[5]) + valor;
|
|
||||||
saldoOrigem -= valor;
|
|
||||||
|
|
||||||
atualizarSaldoCliente(idDestino, saldoDestino);
|
|
||||||
atualizarSaldoCliente(idOrigem, saldoOrigem);
|
|
||||||
|
|
||||||
System.out.printf("Transferência de €%.2f realizada com sucesso!\n", valor);
|
|
||||||
System.out.printf("Novo saldo: €%.2f\n", saldoOrigem);
|
|
||||||
|
|
||||||
return saldoOrigem;
|
return saldoOrigem;
|
||||||
}
|
}
|
||||||
@@ -367,8 +359,8 @@ private static void menuClienteLogado(String[] dadosCliente) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
saldo += valor;
|
saldo += valor;
|
||||||
System.out.printf("Depósito de €%.2f realizado com sucesso!\n", valor);
|
System.out.printf("Depósito de €"+valor+" realizado com sucesso!\n");
|
||||||
System.out.printf("Novo saldo: €%.2f\n", saldo);
|
System.out.printf("Novo saldo: €"+saldo+"\n");
|
||||||
|
|
||||||
return saldo;
|
return saldo;
|
||||||
}
|
}
|
||||||
@@ -395,8 +387,8 @@ private static void menuClienteLogado(String[] dadosCliente) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
saldo -= valor;
|
saldo -= valor;
|
||||||
System.out.printf("Levantamento de €%.2f realizado com sucesso!\n", valor);
|
System.out.printf("Levantamento de €"+valor+" realizado com sucesso!\n");
|
||||||
System.out.printf("Novo saldo: €%.2f\n", saldo);
|
System.out.printf("Novo saldo: €"+saldo+"\n");
|
||||||
|
|
||||||
return saldo;
|
return saldo;
|
||||||
}
|
}
|
||||||
@@ -467,7 +459,7 @@ private static void menuAdmin() {
|
|||||||
+ "║ ▸ 2 Procurar cliente ║\n"
|
+ "║ ▸ 2 Procurar cliente ║\n"
|
||||||
+ "║ ▸ 3 Editar dados de cliente ║\n"
|
+ "║ ▸ 3 Editar dados de cliente ║\n"
|
||||||
+ "║ ▸ 4 Remover cliente ║\n"
|
+ "║ ▸ 4 Remover cliente ║\n"
|
||||||
+ "║ ▸ 5 Estatísticas do sistema ║\n"
|
+ "║ ▸ 5 Estatisticas ║\n"
|
||||||
+ "║ ▸ 6 Sair ║\n"
|
+ "║ ▸ 6 Sair ║\n"
|
||||||
+ "╚════════════════════════════════════════╝\n");
|
+ "╚════════════════════════════════════════╝\n");
|
||||||
|
|
||||||
@@ -486,9 +478,7 @@ private static void menuAdmin() {
|
|||||||
case 4:
|
case 4:
|
||||||
removerCliente();
|
removerCliente();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:mostrarEstatisticas();
|
||||||
mostrarEstatisticas();
|
|
||||||
break;
|
|
||||||
case 6:
|
case 6:
|
||||||
sair = true;
|
sair = true;
|
||||||
break;
|
break;
|
||||||
@@ -688,14 +678,14 @@ private static void mostrarEstatisticas() {
|
|||||||
double saldoMedio = saldoTotal / numClientes;
|
double saldoMedio = saldoTotal / numClientes;
|
||||||
|
|
||||||
System.out.println("\n╔════════════════════════════════════════════════════════════════╗");
|
System.out.println("\n╔════════════════════════════════════════════════════════════════╗");
|
||||||
System.out.println( "║ ESTATÍSTICAS DO SISTEMA ║");
|
System.out.println("║ ESTATÍSTICAS DO SISTEMA ║");
|
||||||
System.out.println( "╠════════════════════════════════════════════════════════════════╣");
|
System.out.println("╠════════════════════════════════════════════════════════════════╣");
|
||||||
System.out.printf( "║\n", "Total de clientes: " + numClientes);
|
System.out.printf("║ Total de clientes: %d%44s%n", numClientes, "║");
|
||||||
System.out.printf( "║\n", String.format("Saldo total do banco: ", saldoTotal));
|
System.out.printf("║ Saldo total do banco: %.2f%33s%n", saldoTotal, "║");
|
||||||
System.out.printf( "║\n", String.format("Saldo médio por cliente: ", saldoMedio));
|
System.out.printf("║ Saldo médio por cliente: %.2f%30s%n", saldoMedio, "║");
|
||||||
System.out.printf( "║\n", String.format("Cliente com maior saldo: ", clienteSaldoMaximo, saldoMaximo));
|
System.out.printf("║ Cliente com maior saldo: %s (%.2f)%23s%n", clienteSaldoMaximo, saldoMaximo, "║");
|
||||||
System.out.printf( "║\n", String.format("Cliente com menor saldo: ", clienteSaldoMinimo, saldoMinimo));
|
System.out.printf("║ Cliente com menor saldo: %s (%.2f)%26s%n", clienteSaldoMinimo, saldoMinimo, "║");
|
||||||
System.out.println( "╚════════════════════════════════════════════════════════════════╝\n");
|
System.out.println("╚════════════════════════════════════════════════════════════════╝\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void atualizarClienteCompleto(String[] dados) {
|
private static void atualizarClienteCompleto(String[] dados) {
|
||||||
@@ -1008,10 +998,11 @@ public static void editarDinheiroCliente() {
|
|||||||
System.out.println("║ ID gerado: " + idTitular);
|
System.out.println("║ ID gerado: " + idTitular);
|
||||||
|
|
||||||
String nif;
|
String nif;
|
||||||
do {
|
|
||||||
System.out.print("║ Introduza NIF (9 dígitos): ");
|
System.out.print("║ Introduza NIF (9 dígitos): ");
|
||||||
nif = scanner.nextLine();
|
nif = scanner.nextLine();
|
||||||
|
|
||||||
|
while (!verificarNIF(nif) || nif.isEmpty());{
|
||||||
if (!verificarNIF(nif)) {
|
if (!verificarNIF(nif)) {
|
||||||
System.out.println("║ NIF inválido! Deve ter 9 dígitos válidos.");
|
System.out.println("║ NIF inválido! Deve ter 9 dígitos válidos.");
|
||||||
} else if (nifJaExiste(nif)) {
|
} else if (nifJaExiste(nif)) {
|
||||||
@@ -1019,13 +1010,14 @@ public static void editarDinheiroCliente() {
|
|||||||
System.out.println("║ Por favor, insira um NIF diferente.");
|
System.out.println("║ Por favor, insira um NIF diferente.");
|
||||||
nif = "";
|
nif = "";
|
||||||
}
|
}
|
||||||
} while (!verificarNIF(nif) || nif.isEmpty());
|
}
|
||||||
|
|
||||||
String telefone;
|
String telefone;
|
||||||
|
|
||||||
System.out.print("║ Introduza telefone (9 dígitos): ");
|
System.out.print("║ Introduza telefone (9 dígitos): ");
|
||||||
telefone = scanner.nextLine();
|
telefone = scanner.nextLine();
|
||||||
|
|
||||||
|
while (telefone.isEmpty() || telefone.length() != 9 || !telefone.matches("\\d+")){
|
||||||
if (telefone.length() != 9 || !telefone.matches("\\d+")) {
|
if (telefone.length() != 9 || !telefone.matches("\\d+")) {
|
||||||
System.out.println("║ Telefone inválido! Deve ter 9 dígitos.");
|
System.out.println("║ Telefone inválido! Deve ter 9 dígitos.");
|
||||||
} else if (telefoneJaExiste(telefone)) {
|
} else if (telefoneJaExiste(telefone)) {
|
||||||
@@ -1033,7 +1025,7 @@ public static void editarDinheiroCliente() {
|
|||||||
System.out.println("║ Por favor, insira um telefone diferente.");
|
System.out.println("║ Por favor, insira um telefone diferente.");
|
||||||
telefone = "";
|
telefone = "";
|
||||||
}
|
}
|
||||||
while (telefone.isEmpty() || telefone.length() != 9 || !telefone.matches("\\d+"));
|
}
|
||||||
|
|
||||||
String email;
|
String email;
|
||||||
|
|
||||||
@@ -1063,7 +1055,7 @@ public static void editarDinheiroCliente() {
|
|||||||
|
|
||||||
String cliente = nome + "," + idTitular + "," + telefone + "," + email + "," + nif + "," + saldoTxt + "\n";
|
String cliente = nome + "," + idTitular + "," + telefone + "," + email + "," + nif + "," + saldoTxt + "\n";
|
||||||
adicionaTextoAoFicheiro(cliente, "clientes.txt");
|
adicionaTextoAoFicheiro(cliente, "clientes.txt");
|
||||||
}
|
}
|
||||||
// Taxas baseadas no EURO
|
// Taxas baseadas no EURO
|
||||||
|
|
||||||
static double[] taxas = {
|
static double[] taxas = {
|
||||||
@@ -1145,81 +1137,66 @@ public static void editarDinheiroCliente() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void moeda() {
|
public static void moeda() {
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
Scanner sc = new Scanner(System.in);
|
int opcao;
|
||||||
|
|
||||||
int opcao = 1;
|
do {
|
||||||
|
System.out.println("\n=== MOEDAS DISPONIVEIS === " + " ⣀⣠⣤⣤⣤⣀⡀");
|
||||||
while (opcao != 0) {
|
System.out.println("1 - EUR — € — European Union " + " ⣀⣴⣿⣿⠿⠿⠿⠿⢿⣿⣷⠄");
|
||||||
|
System.out.println("2 - USD — $ — United States " + " ⢀⣴⣿⠟⠉⠀⠀⠀⠀⠀⠀⠈⠉⠀");
|
||||||
System.out.println("\n=== MOEDAS DISPONIVEIS === "+ " ⣀⣠⣤⣤⣤⣀⡀");
|
System.out.println("3 - JPY — ¥ — Japan " + " ⣀⣀⣀⣾⣿⣇⣀⣀⣀⣀⣀⣀⣀⣀⠀");
|
||||||
System.out.println("1 - EUR — € — European Union "+ " ⣀⣴⣿⣿⠿⠿⠿⠿⢿⣿⣷⠄");
|
System.out.println("4 - GBP — £ — United Kingdom " + " ⠛⠛⢻⣿⣿⠛⠛⠛⠛⠛⠛⠛⠛⠛⠀");
|
||||||
System.out.println("2 - USD — $ — United States "+ " ⢀⣴⣿⠟⠉⠀⠀⠀⠀⠀⠀⠈⠉⠀");
|
System.out.println("5 - CNY — ¥ — China " + " ⣤⣤⣼⣿⣿⣤⣤⣤⣤⣤⣤⣤⣤⣤⠀");
|
||||||
System.out.println("3 - JPY — ¥ — Japan "+ " ⣀⣀⣀⣾⣿⣇⣀⣀⣀⣀⣀⣀⣀⣀⠀");
|
System.out.println("6 — AUD — A$ — Australia " + " ⠉⠉⠉⢿⣿⣏⠉⠉⠉⠉⠉⠉⠉⠉⠀");
|
||||||
System.out.println("4 - GBP — £ — United Kingdom "+ " ⠛⠛⢻⣿⣿⠛⠛⠛⠛⠛⠛⠛⠛⠛⠀");
|
System.out.println("7 — CAD — C$ — Canada " + " ⠈⢻⣿⣦⣀⠀⠀⠀⠀⠀⠀⢀⣀⠀");
|
||||||
System.out.println("5 - CNY — ¥ — China "+ " ⣤⣤⣼⣿⣿⣤⣤⣤⣤⣤⣤⣤⣤⣤⠀");
|
System.out.println("8 — CHF — Fr — Switzerland " + " ⠉⠻⣿⣿⣶⣶⣶⣶⣿⣿⡿⠃⠀\n"
|
||||||
System.out.println("6 - AUD — A$ — Australia "+ " ⠉⠉⠉⢿⣿⣏⠉⠉⠉⠉⠉⠉⠉⠉⠀");
|
+ " ⠉⠙⠛⠛⠛⠉⠁⠀⠀⠀");
|
||||||
System.out.println("7 - CAD — C$ — Canada "+ " ⠈⢻⣿⣦⣀⠀⠀⠀⠀⠀⠀⢀⣀⠀");
|
|
||||||
System.out.println("8 - CHF — Fr — Switzerland "+ " ⠉⠻⣿⣿⣶⣶⣶⣶⣿⣿⡿⠃⠀\n"
|
int origem = 0;
|
||||||
+ " ⠉⠙⠛⠛⠛⠉⠁⠀⠀⠀" );
|
while (true) {
|
||||||
|
System.out.print("\nEscolha a moeda a converter: ");
|
||||||
int origem;
|
origem = sc.nextInt();
|
||||||
while (true) {
|
if (origem >= 1 && origem <= 8) break;
|
||||||
System.out.print("\nEscolha a moeda a converter: ");
|
System.out.println("Opção inválida. Insira novamente.");
|
||||||
origem = sc.nextInt();
|
}
|
||||||
if (origem >= 1 && origem <= 8) break;
|
|
||||||
|
int destino = 0;
|
||||||
System.out.println("Opção invalida. Insira novamente.");
|
while (true) {
|
||||||
|
System.out.print("Escolha a moeda pretendida: ");
|
||||||
}
|
destino = sc.nextInt();
|
||||||
|
if (destino >= 1 && destino <= 8) break;
|
||||||
int destino;
|
System.out.println("Opção inválida. Insira novamente.");
|
||||||
|
}
|
||||||
while (true) {
|
|
||||||
|
System.out.print("Valor a converter: ");
|
||||||
System.out.print("Escolhe a moeda pretendida: ");
|
double valor = sc.nextDouble();
|
||||||
|
|
||||||
destino = sc.nextInt();
|
double resultado = converter(valor, origem - 1, destino - 1);
|
||||||
|
|
||||||
if (destino >= 1 && destino <= 8) break;
|
System.out.println("\n=== RESULTADO ===");
|
||||||
|
System.out.println(valor + " " + simboloMoeda(origem) +
|
||||||
System.out.println("Opção invalida. Insira novamente.");
|
" = " + resultado + " " + simboloMoeda(destino));
|
||||||
|
|
||||||
}
|
System.out.println("\n1 - Nova conversão");
|
||||||
|
System.out.println("2 - Sair");
|
||||||
System.out.print("Valor a converter: ");
|
System.out.print("Opção: ");
|
||||||
|
opcao = sc.nextInt();
|
||||||
double valor = sc.nextDouble();
|
|
||||||
|
switch(opcao) {
|
||||||
double resultado = converter(valor, origem - 1, destino - 1);
|
case 1: //Repetir
|
||||||
|
break;
|
||||||
System.out.println("\n=== RESULTADO ===");
|
case 2:
|
||||||
|
System.out.println("A sair da conversão de moedas...");
|
||||||
System.out.println(valor + " " +
|
break;
|
||||||
|
default:
|
||||||
simboloMoeda(origem) +
|
System.out.println("Opção inválida! A encerrar...");
|
||||||
|
opcao = 2;
|
||||||
" = " +
|
}
|
||||||
|
|
||||||
resultado +
|
} while (opcao != 2);
|
||||||
|
|
||||||
" " +
|
System.out.println("Programa terminado.");
|
||||||
|
}
|
||||||
simboloMoeda(destino));
|
|
||||||
|
|
||||||
System.out.println("\n1 - Nova conversão");
|
|
||||||
|
|
||||||
System.out.println("0 - Sair");
|
|
||||||
|
|
||||||
System.out.print("Opção: ");
|
|
||||||
|
|
||||||
opcao = sc.nextInt();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Programa terminado.");
|
|
||||||
|
|
||||||
}
|
|
||||||
private static final String[] UNIDADES = {
|
private static final String[] UNIDADES = {
|
||||||
"zero", "um", "dois", "três", "quatro",
|
"zero", "um", "dois", "três", "quatro",
|
||||||
"cinco", "seis", "sete", "oito", "nove"
|
"cinco", "seis", "sete", "oito", "nove"
|
||||||
@@ -1287,7 +1264,7 @@ public static void editarDinheiroCliente() {
|
|||||||
System.out.println("│ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ │");
|
System.out.println("│ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ │");
|
||||||
System.out.println("│ │");
|
System.out.println("│ │");
|
||||||
System.out.println("│ Pague por este cheque a: │");
|
System.out.println("│ Pague por este cheque a: │");
|
||||||
System.out.printf( "│ %-60s │%n", beneficiario);
|
System.out.printf( "│ %-59s │%n", beneficiario);
|
||||||
System.out.println("│ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ │");
|
System.out.println("│ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ │");
|
||||||
System.out.println("│ │");
|
System.out.println("│ │");
|
||||||
System.out.printf( "│ A quantia de: %-45s │%n", quantiaPorExtenso);
|
System.out.printf( "│ A quantia de: %-45s │%n", quantiaPorExtenso);
|
||||||
@@ -1298,7 +1275,7 @@ public static void editarDinheiroCliente() {
|
|||||||
System.out.println("│ │");
|
System.out.println("│ │");
|
||||||
System.out.printf( "│ %45s │%n", assinatura);
|
System.out.printf( "│ %45s │%n", assinatura);
|
||||||
System.out.println("│ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ │");
|
System.out.println("│ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ │");
|
||||||
System.out.printf( "│ %49s │%n", "Assinatura");
|
System.out.printf( "│ %45s │%n", "Assinatura ");
|
||||||
System.out.println( "│ │");
|
System.out.println( "│ │");
|
||||||
System.out.println("└──────────────────────────────────────────────────────────────┘");
|
System.out.println("└──────────────────────────────────────────────────────────────┘");
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user