Skip to content

Commit

Permalink
dive
Browse files Browse the repository at this point in the history
  • Loading branch information
raynivis committed Jun 3, 2024
1 parent cbe39f2 commit 6ca1141
Show file tree
Hide file tree
Showing 13 changed files with 160 additions and 63 deletions.
6 changes: 3 additions & 3 deletions EstacionamentoBemMayRay/src/Estacionamento.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import ufms.cptl.raymay.Classes.Interno.Tarifas.Tarifa;
import ufms.cptl.raymay.Classes.Interno.Tickets.Ticket;
import ufms.cptl.raymay.Classes.Interno.Vaga;
import ufms.cptl.raymay.InterfaceOp.InterfaceInicial;
import ufms.cptl.raymay.InterfaceOpcoes.InterfaceInicial;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceGrafica;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceTerminal;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceGrafica;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceTerminal;
import ufms.cptl.raymay.Teste.ListasProntas;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package ufms.cptl.raymay.Interface.UserInterface;
package ufms.cptl.raymay.Interface.InterfaceDoUsuario;

import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import javax.swing.JOptionPane;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoCadastroGeral;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoCliente;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoEstacionamento;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoInicial;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoTarifa;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoVaga;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoVeiculo;

Expand Down Expand Up @@ -87,8 +89,6 @@ public String receberString(String mensagem){





public int imprimeVaga() {
OpcaoVaga.InterVaga[] op = OpcaoVaga.InterVaga.values();
String[] opDesc = new String[op.length];
Expand Down Expand Up @@ -172,5 +172,61 @@ public int imprimeVeiculo(){
/* Opcao inválida, tera um break na interface */
return -1;
}

public int imprimeEstacionamento(){
OpcaoEstacionamento.InterEstacionamento[] op = OpcaoEstacionamento.InterEstacionamento.values();
String[] opDesc = new String[op.length];
for (int i = 0; i < op.length; i++) {
opDesc[i] = op[i].getValorOpcao() + ". " + op[i].getDesc();
}

String escolha = (String) JOptionPane.showInputDialog(
null,
"Escolha uma opção:",
"Menu Estacionamento",
JOptionPane.INFORMATION_MESSAGE,
null,
opDesc,
opDesc[0]);

// Converte a escolha para o enum correspondente e obtém o valor da opção
if (escolha != null) {
for (OpcaoEstacionamento.InterEstacionamento opcao : op) {
if (escolha.equals(opcao.getValorOpcao() + ". " + opcao.getDesc())) {
return opcao.getValorOpcao();
}
}
}
/* Opcao inválida*/
return -1;
}

public int imprimeTarifa(){
OpcaoTarifa.InterTarifa[] op = OpcaoTarifa.InterTarifa.values();
String[] opDesc = new String[op.length];
for (int i = 0; i < op.length; i++) {
opDesc[i] = op[i].getValorOpcao() + ". " + op[i].getDesc();
}

String escolha = (String) JOptionPane.showInputDialog(
null,
"Escolha uma opção:",
"Menu Tarifa",
JOptionPane.INFORMATION_MESSAGE,
null,
opDesc,
opDesc[0]);

// Converte a escolha para o enum correspondente e obtém o valor da opção
if (escolha != null) {
for (OpcaoTarifa.InterTarifa opcao : op) {
if (escolha.equals(opcao.getValorOpcao() + ". " + opcao.getDesc())) {
return opcao.getValorOpcao();
}
}
}
/* Opcao inválida, tera um break na interface */
return -1;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package ufms.cptl.raymay.Interface.UserInterface;
package ufms.cptl.raymay.Interface.InterfaceDoUsuario;

import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;
import javax.swing.JOptionPane;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoCadastroGeral;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoCliente;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoEstacionamento;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoInicial;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoTarifa;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoVaga;
import ufms.cptl.raymay.Interface.EnumOpcao.OpcaoVeiculo;
import static ufms.cptl.raymay.InterfaceOp.MostraMensagem.interMensagem;
import static ufms.cptl.raymay.InterfaceOpcoes.MostraMensagem.interMensagem;

/**
*
Expand Down Expand Up @@ -110,6 +111,34 @@ public int imprimeVeiculo() {
scanner.nextLine();
return opcao3;
}
}

public int imprimeEstacionamento(){
try {
PrintStream out = new PrintStream(System.out, true, StandardCharsets.UTF_8.toString());
for (OpcaoEstacionamento.InterEstacionamento op : OpcaoEstacionamento.InterEstacionamento.values()) {
out.println(op.getValorOpcao() + " - " + op.getDesc());
}
} catch (UnsupportedEncodingException e) {
}
int opcao2 = scanner.nextInt();
scanner.nextLine();
return opcao2;
}


public int imprimeTarifa(){
try {
PrintStream out = new PrintStream(System.out, true, StandardCharsets.UTF_8.toString());
for (OpcaoTarifa.InterTarifa op : OpcaoTarifa.InterTarifa.values()) {
out.println(op.getValorOpcao() + " - " + op.getDesc());
}
} catch (UnsupportedEncodingException e) {
}
int opcao3 = scanner.nextByte();
scanner.nextLine();
return opcao3;
}
}



Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package ufms.cptl.raymay.Interface.UserInterface;
package ufms.cptl.raymay.Interface.InterfaceDoUsuario;



Expand All @@ -22,7 +22,12 @@ public interface UserInterface{

public int imprimeEstacionamento();


public int imprimeTarifa();

public int imprimeVaga();

public int imprimeCliente();

public int imprimeVeiculo();

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package ufms.cptl.raymay.InterfaceOp;
package ufms.cptl.raymay.InterfaceOpcoes;

import java.util.List;
import java.util.Scanner;
Expand All @@ -11,9 +11,9 @@
import ufms.cptl.raymay.Classes.Externo.Automovel.Modelo;
import ufms.cptl.raymay.Classes.Externo.Automovel.Veiculo;
import ufms.cptl.raymay.Classes.Externo.Individuo.Cliente;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceGrafica;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceTerminal;
import ufms.cptl.raymay.Interface.UserInterface.UserInterface;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceGrafica;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceTerminal;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.UserInterface;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package ufms.cptl.raymay.InterfaceOp;
package ufms.cptl.raymay.InterfaceOpcoes;

import java.util.List;
import java.util.Scanner;
import ufms.cptl.raymay.Classes.Enum.DiaSemana;
import ufms.cptl.raymay.Classes.Enum.TipoVeiculo;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceGrafica;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceTerminal;
import ufms.cptl.raymay.Interface.UserInterface.UserInterface;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceGrafica;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceTerminal;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.UserInterface;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package ufms.cptl.raymay.InterfaceOp;
package ufms.cptl.raymay.InterfaceOpcoes;

import java.text.NumberFormat;
import java.time.LocalDateTime;
Expand All @@ -22,9 +22,9 @@
import ufms.cptl.raymay.Classes.Interno.Tickets.TicketMensalista;
import ufms.cptl.raymay.Classes.Interno.Vaga;
import ufms.cptl.raymay.Classes.Enum.Operando;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceGrafica;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceTerminal;
import ufms.cptl.raymay.Interface.UserInterface.UserInterface;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceGrafica;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceTerminal;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.UserInterface;
import ufms.cptl.raymay.Operacoes.OperacoesCliente;
import ufms.cptl.raymay.Operacoes.OperacoesTicket;
import ufms.cptl.raymay.Operacoes.OperacoesVagas;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package ufms.cptl.raymay.InterfaceOp;
package ufms.cptl.raymay.InterfaceOpcoes;


import java.util.ArrayList;
Expand All @@ -14,10 +14,10 @@
import ufms.cptl.raymay.Classes.Interno.Tarifas.Tarifa;
import ufms.cptl.raymay.Classes.Interno.Tickets.Ticket;
import ufms.cptl.raymay.Classes.Interno.Vaga;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceGrafica;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceTerminal;
import ufms.cptl.raymay.Interface.UserInterface.UserInterface;
import static ufms.cptl.raymay.InterfaceOp.MostraMensagem.interMensagem;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceGrafica;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceTerminal;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.UserInterface;
import static ufms.cptl.raymay.InterfaceOpcoes.MostraMensagem.interMensagem;
import ufms.cptl.raymay.Operacoes.OperacoesCliente;
/**
*
Expand Down Expand Up @@ -123,13 +123,17 @@ public void opcoesCliente(List<Cliente> clientes, List<Vaga> vagas, List<Ticket>
cpf = interfaces.receberString("Digite o CPF");
if(opCliente.relatorioCliente(clientes, cpf) == null){
interfaces.mensagem("\nCliente não encontrado!\n");
}
} else {
interfaces.mensagem(opCliente.relatorioCliente(clientes, cpf));
}
}else {
InterfaceGrafica interfaces = (InterfaceGrafica) inter;
cpf = interfaces.receberString("Digite o CPF");
if(opCliente.relatorioCliente(clientes, cpf) == null){
interfaces.mensagem("\nCliente não encontrado!\n");
}
} else {
interfaces.mensagem(opCliente.relatorioCliente(clientes, cpf));
}
}
break;
case 3:
Expand Down Expand Up @@ -220,6 +224,15 @@ public void opcoesCliente(List<Cliente> clientes, List<Vaga> vagas, List<Ticket>

interfaces.mensagem("Os veículos do cliente " + operador.getNome() + " são:\n");
}
if(face == 0){
InterfaceTerminal interfaces = (InterfaceTerminal) inter;
interfaces.mensagem(opCliente.mostraVeiculos(clientes, cpf));
}
else {
InterfaceGrafica interfaces = (InterfaceGrafica) inter;
interfaces.mensagem(opCliente.mostraVeiculos(clientes, cpf));
}

opCliente.mostraVeiculos(clientes, cpf); /* ARRUMAR */
do{
/* Utiliza o método criado em ItensMenu, reduzindo o tamanho
Expand All @@ -236,8 +249,7 @@ public void opcoesCliente(List<Cliente> clientes, List<Vaga> vagas, List<Ticket>
case 1: /*Adicionar um veículo*/
Veiculo veiculoAdicional = InVeiculo.receberVeiculo(clientes, operador, inter, face);
if(face == 0) {
InterfaceTerminal interfaces = (InterfaceTerminal) inter;

InterfaceTerminal interfaces = (InterfaceTerminal) inter;
if(veiculoAdicional != null) {
operador.addVeiculo(veiculoAdicional);
interfaces.mensagem("Veículo cadastrado com sucesso!!");
Expand Down Expand Up @@ -318,7 +330,7 @@ public void opcoesCliente(List<Cliente> clientes, List<Vaga> vagas, List<Ticket>
InterfaceGrafica interfaces = (InterfaceGrafica) inter;
interfaces.mensagem("Insira uma opção válida!");
}
break;
break;
}
}while(opcao3 != 4);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package ufms.cptl.raymay.InterfaceOp;
package ufms.cptl.raymay.InterfaceOpcoes;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
Expand All @@ -21,9 +21,9 @@
import ufms.cptl.raymay.Classes.Interno.Tickets.TicketHorista;
import ufms.cptl.raymay.Classes.Interno.Tickets.TicketMensalista;
import ufms.cptl.raymay.Classes.Interno.Vaga;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceGrafica;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceTerminal;
import ufms.cptl.raymay.Interface.UserInterface.UserInterface;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceGrafica;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceTerminal;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.UserInterface;
import ufms.cptl.raymay.Operacoes.OperacoesCliente;
import ufms.cptl.raymay.Operacoes.OperacoesTicket;
import ufms.cptl.raymay.Operacoes.OperacoesVagas;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package ufms.cptl.raymay.InterfaceOp;
package ufms.cptl.raymay.InterfaceOpcoes;

import java.util.List;
import java.util.Scanner;
Expand All @@ -12,11 +12,11 @@
import ufms.cptl.raymay.Classes.Interno.Tarifas.Tarifa;
import ufms.cptl.raymay.Classes.Interno.Tickets.Ticket;
import ufms.cptl.raymay.Classes.Interno.Vaga;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceGrafica;
import static ufms.cptl.raymay.InterfaceOp.MostraMensagem.interMensagem;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceGrafica;
import static ufms.cptl.raymay.InterfaceOpcoes.MostraMensagem.interMensagem;
import ufms.cptl.raymay.Operacoes.OperacoesVagas;
import ufms.cptl.raymay.Interface.UserInterface.InterfaceTerminal;
import ufms.cptl.raymay.Interface.UserInterface.UserInterface;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.InterfaceTerminal;
import ufms.cptl.raymay.Interface.InterfaceDoUsuario.UserInterface;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package ufms.cptl.raymay.InterfaceOp;
package ufms.cptl.raymay.InterfaceOpcoes;

import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package ufms.cptl.raymay.InterfaceOp;
package ufms.cptl.raymay.InterfaceOpcoes;

import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
Expand Down
Loading

0 comments on commit 6ca1141

Please sign in to comment.