Skip to content

Commit

Permalink
Merge pull request #20 from raynivis/newMayaraAtts
Browse files Browse the repository at this point in the history
interface terminal
  • Loading branch information
mayaramog authored Jun 22, 2024
2 parents 06f74e8 + a20b59f commit f44725d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,47 +40,43 @@ public String receberString(String mensagem){

@Override
public int imprimirInicio(){
if(terminalMenu.adaptarInterfaceMenu(InterMenuInicial.class, receberString("Menu Inicial")) == 0) {
int opcao = scanner.nextInt();
scanner.nextLine();
return opcao;
} else
return -1;
int opcao = terminalMenu.adaptarInterfaceMenu(InterMenuInicial.class, "Menu Inicial");
return opcao;
}

@Override
public int imprimirCadastroGeral(){
int opcao3 = terminalMenu.adaptarInterfaceMenu(InterMenuCadastroGeral.class, receberString("Menu Cadastro Geral"));
return opcao3;
public int imprimirCadastroGeral(){
int opcao3 = terminalMenu.adaptarInterfaceMenu(InterMenuCadastroGeral.class, "Menu Cadastro Geral");
return opcao3;
}

@Override
public int imprimirCliente() {
int opcao2 = terminalMenu.adaptarInterfaceMenu(InterMenuCliente.class, receberString("Menu Cliente"));
int opcao2 = terminalMenu.adaptarInterfaceMenu(InterMenuCliente.class, "Menu Cliente");
return opcao2;
}

@Override
public int imprimirVeiculo() {
int opcao3 = terminalMenu.adaptarInterfaceMenu(InterMenuVeiculo.class, receberString("Menu gerenciamento de Veículo"));
int opcao3 = terminalMenu.adaptarInterfaceMenu(InterMenuVeiculo.class, "Menu gerenciamento de Veículo");
return opcao3;
}

@Override
public int imprimirVaga() {
int opcao2 = terminalMenu.adaptarInterfaceMenu(InterMenuVaga.class, receberString("Menu Vaga"));
int opcao2 = terminalMenu.adaptarInterfaceMenu(InterMenuVaga.class, "Menu Vaga");
return opcao2;
}

@Override
public int imprimirEstacionamento(){
int opcao2 = terminalMenu.adaptarInterfaceMenu(InterMenuEstacionamento.class, receberString("Menu Estacionamento"));
int opcao2 = terminalMenu.adaptarInterfaceMenu(InterMenuEstacionamento.class, "Menu Estacionamento");
return opcao2;
}

@Override
public int imprimirTarifa(){
int opcao3 = terminalMenu.adaptarInterfaceMenu(InterMenuTarifa.class, receberString("Menu Tarifa"));
int opcao3 = terminalMenu.adaptarInterfaceMenu(InterMenuTarifa.class, "Menu Tarifa");
return opcao3;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package ufms.cptl.raymay.Interface.Menu;

import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;
import ufms.cptl.raymay.Interface.EnumOpcao.InterMenuGeral;
Expand All @@ -19,14 +18,20 @@ public class MenuTerminal implements Menu{

@Override
public <T extends Enum<T> & InterMenuGeral> int adaptarInterfaceMenu(Class<T> escolhaMenu, String menuSelecao) {
try {
PrintStream out = new PrintStream(System.out, true, StandardCharsets.UTF_8.toString());
out.println(menuSelecao + "\n");
for (T op : escolhaMenu.getEnumConstants()) {
System.out.println(op.getValorOpcao() + " - " + op.getDesc());
try {
PrintStream out = new PrintStream(System.out, true, StandardCharsets.UTF_8.name());
out.println(menuSelecao);

T[] menu = escolhaMenu.getEnumConstants();
for (T constant : menu) {
out.println(constant.getValorOpcao() + " - " + constant.getDesc());
}
return 0;
} catch (UnsupportedEncodingException e) { /*REVISAR ESSE TRYCATCHHHHHH*/

int opcao = scanner.nextInt();
scanner.nextLine();
return opcao;

} catch (Exception e) {
return -1;
}
}
Expand Down

0 comments on commit f44725d

Please sign in to comment.