Guest User

Untitled

a guest
Jul 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. public String introduzirPergunta(int numero, String epoca, int ano, String disciplina, String curso, String topico1, String topico2, String topico3, ArrayList<String> enunciado){
  2. boolean temErro = false;
  3.  
  4. if(topico1.equals(topico2) || topico2.equals(topico3) || topico1.equals(topico3)){
  5. resultado = "Existencia de topicos repetidos.";
  6. temErro = true;
  7. }
  8. else{
  9. if(!perguntas.isEmpty()){
  10. ChavePergunta auxKey = new ChavePergunta(numero, epoca, ano, disciplina, curso);
  11.  
  12. if(perguntas.containsKey(auxKey)){
  13. resultado = "Existencia da pergunta referida.";
  14. temErro = true;
  15. }
  16. }
  17. }
  18.  
  19. if(!temErro){
  20. ChavePergunta auxKey = new ChavePergunta(numero, epoca, ano, disciplina, curso);
  21. Pergunta auxPergunta = new Pergunta(numero, epoca, ano, disciplina, curso, topico1, topico2, topico3, enunciado);
  22.  
  23. perguntas.put(auxKey, auxPergunta);
  24.  
  25. inserirTopico(topico1, auxPergunta);
  26. inserirTopico(topico2, auxPergunta);
  27. inserirTopico(topico3, auxPergunta);
  28.  
  29. resultado = "Insercao da pergunta com sucesso.";
  30. }
  31.  
  32. return resultado;
  33. }
Add Comment
Please, Sign In to add comment