Skip to content

Commit

Permalink
coooomite
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipe Guimarães committed May 25, 2019
1 parent 35ef09c commit a16e0dc
Show file tree
Hide file tree
Showing 37 changed files with 2,180 additions and 1,062 deletions.
42 changes: 22 additions & 20 deletions Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private void run()throws IOException{
escolha=0;
continue;
} catch (ClassNotFoundException e){
System.out.println("Erro: "+e);
System.out.println("Erro: "+e.getMessage());
view.enterContinuar();
escolha = 0;
continue;
Expand All @@ -83,7 +83,7 @@ private void run()throws IOException{
Carregamento.escreverFicheiroOjeto(this.servico,OBJ_PATH);
System.out.println("Guardado com sucesso");
} catch (IOException e){
System.out.println(View.RED+"Erro ao escrever ficheiro: "+View.RESET+e);
System.out.println(View.RED+"Erro ao escrever ficheiro: "+View.RESET+e.getMessage());
}
view.enterContinuar();
escolha=0;
Expand Down Expand Up @@ -115,9 +115,11 @@ private int runEscolherAtor(){
case 1:
view.souCliente();
escolha = runCliente();
break;
case 2 :
view.souProprietario();
escolha = runProprietario();
break;
default:
break;
}
Expand All @@ -141,7 +143,7 @@ private int runLogin(){
nif = servico.login(email1,pass1);
escolha = 0;
}catch (AutenticacaoException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
continue;
}
Expand All @@ -159,15 +161,15 @@ private int runLogin(){
try{
servico.adicionaCliente(email,pass,nif,nome,morada,data);
} catch (AtorException a){
System.out.println(a);
System.out.println(a.getMessage());
view.enterContinuar();
}
}
if (view.getAtor()==View.PROPRIETARIO){
try {
servico.adicionaProprietario(email,pass,nif,nome,morada,data);
}catch (AtorException a){
System.out.println(a);
System.out.println(a.getMessage());
view.enterContinuar();
}
}
Expand Down Expand Up @@ -275,7 +277,7 @@ private int runAluguer(int nif){
view.enterContinuar();
escolha=0;
}catch (AtorException|AluguerException|CarroException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
escolha=1;
}
Expand All @@ -289,7 +291,7 @@ private int runAluguer(int nif){
view.enterContinuar();
escolha=0;
}catch (CarroException|AluguerException|AtorException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
}
break;
Expand All @@ -302,7 +304,7 @@ private int runAluguer(int nif){
view.enterContinuar();
escolha=0;
}catch (CarroException|AluguerException|AtorException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
}
break;
Expand All @@ -316,7 +318,7 @@ private int runAluguer(int nif){
view.enterContinuar();
escolha=0;
}catch (CarroException|AluguerException|AtorException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
}
break;
Expand All @@ -330,7 +332,7 @@ private int runAluguer(int nif){
view.enterContinuar();
escolha=0;
}catch (AtorException|AluguerException|CarroException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
escolha=1;
}
Expand Down Expand Up @@ -373,21 +375,21 @@ private int runProprietario(){
try {
servico.adicionaCarroEletrico(marca,matricula,nif,velocidade,preco,localizacao,consumo,autonomia);
} catch (CarroException|AtorException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
}
} else if(tipo.contains("Gasolina")){
try {
servico.adicionaCarroGasolina(marca,matricula,nif,velocidade,preco,localizacao,consumo,autonomia);
} catch (CarroException|AtorException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
}
} else if(tipo.contains("Hibrido")){
try {
servico.adicionaCarroHibrido(marca,matricula,nif,velocidade,preco,localizacao,consumo,autonomia);
} catch (CarroException|AtorException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
}
}
Expand All @@ -399,7 +401,7 @@ private int runProprietario(){
System.out.println(lista);
view.listaCarros(lista);
}catch (AtorException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
}
break;
Expand All @@ -417,7 +419,7 @@ private int runProprietario(){
servico.procuraProprietario(nif).alteraPreco(preco4,matricula4);
view.precoAlterado();
} catch (AtorException|CarroException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
continue;
}
Expand All @@ -429,7 +431,7 @@ private int runProprietario(){
try{
view.carroAbastecido(servico.procuraCarro(matricula5).abasteceCarro(tipoCombustivel));
}catch (CarroException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
continue;
}
Expand All @@ -443,12 +445,12 @@ private int runProprietario(){
try {
servico.terminaAluguer(estado,nifCliente);
}catch(CarroException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
continue;
}
}catch (AtorException | AluguerException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
continue;
}
Expand All @@ -459,7 +461,7 @@ private int runProprietario(){
servico.verMorada(nif),servico.verDataNascimente(nif),servico.verClassificacao(nif),
servico.verNumeroAluguer(nif));
} catch (AtorException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
continue;
}
Expand Down Expand Up @@ -508,7 +510,7 @@ public int runExtras(){
view.imprimeTotalFaturado(matricula3,servico.totalFaturadoPeriodo(matricula3,datainicio,datafim));
view.enterContinuar();
}catch (CarroException e){
System.out.println(e);
System.out.println(e.getMessage());
view.enterContinuar();
escolha=1;
view.enterContinuar();
Expand Down
Loading

0 comments on commit a16e0dc

Please sign in to comment.