diff --git a/.gitignore b/.gitignore index 7ab7091..427f189 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ target/ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* +/nbproject/ \ No newline at end of file diff --git a/src/main/java/br/utfpr/tdd/ex1/Aluno.java b/src/main/java/br/utfpr/tdd/ex1/Aluno.java index 63588d7..6ea25e5 100644 --- a/src/main/java/br/utfpr/tdd/ex1/Aluno.java +++ b/src/main/java/br/utfpr/tdd/ex1/Aluno.java @@ -42,10 +42,15 @@ void setNotaProjeto(double nota) { } double getNF() { + double notaAUX; if(notaRAA < 0) return (notaProjeto + getNAP()) / 2.0; - return (notaProjeto + getNAP() + notaRAA) / 3.0; + else + notaAUX = (notaProjeto + getNAP() + notaRAA) / 3.0; + if(notaAUX >= 6.0) + return 6.0; + return notaAUX; } void setNotaRAA(double nota) { diff --git a/src/main/java/br/utfpr/tdd/ex1/EscritorCSV.java b/src/main/java/br/utfpr/tdd/ex1/EscritorCSV.java index 6aec7ca..1f373f2 100644 --- a/src/main/java/br/utfpr/tdd/ex1/EscritorCSV.java +++ b/src/main/java/br/utfpr/tdd/ex1/EscritorCSV.java @@ -18,7 +18,7 @@ */ class EscritorCSV { CSVPrinter csvPrinter; - private final static Logger LOGGER = Logger.getLogger(EscritorCSV.class.getName()); + private static final Logger LOGGER = Logger.getLogger(EscritorCSV.class.getName()); void escrever(String ra, String nome, double notaFinal, String situacao) { try { @@ -41,7 +41,8 @@ void setArquivoSaida(String filePath) { csvPrinter = new CSVPrinter(writer, CSVFormat.DEFAULT .withHeader("RA", "Nome", "NF", "Situacao")); - csvPrinter.flush(); + csvPrinter.flush(); + writer.close(); } catch(Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e);