Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/br/utfpr/tdd/ex1/Aluno.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ void setNotaProjeto(double nota) {
double getNF() {
if(notaRAA < 0)
return (notaProjeto + getNAP()) / 2.0;

return (notaProjeto + getNAP() + notaRAA) / 3.0;

double NF = (notaProjeto + getNAP() + notaRAA) / 3.0 ;
return NF > 6 ? 6 : NF;
}

void setNotaRAA(double nota) {
Expand Down
25 changes: 12 additions & 13 deletions src/main/java/br/utfpr/tdd/ex1/EscritorCSV.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package br.utfpr.tdd.ex1;

import java.io.BufferedWriter;
import java.io.IOException;
import java.math.RoundingMode;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand All @@ -9,28 +10,27 @@
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;

/**
*
* @author andreendo
*/
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 {
Locale locale = new Locale("en", "UK");
Locale locale = new Locale("en", "UK");
DecimalFormat df = (DecimalFormat)
NumberFormat.getNumberInstance(locale);
NumberFormat.getNumberInstance(locale);
df.applyPattern(".#");
df.setRoundingMode(RoundingMode.DOWN);
csvPrinter.printRecord(ra, nome, df.format(notaFinal), situacao);
csvPrinter.flush();
}
catch(Exception e) {
csvPrinter.flush();
} catch (Exception e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
}
Expand All @@ -40,12 +40,11 @@ void setArquivoSaida(String filePath) {
BufferedWriter writer = Files.newBufferedWriter(Paths.get(filePath));

csvPrinter = new CSVPrinter(writer, CSVFormat.DEFAULT
.withHeader("RA", "Nome", "NF", "Situacao"));
csvPrinter.flush();
}
catch(Exception e) {
.withHeader("RA", "Nome", "NF", "Situacao"));
csvPrinter.flush();
} catch (Exception e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
}

}