0
I have this method
public void calcularVotosTotal(){
System.out.println("votos valiudos " + this.getNumeroEleitores() * 0.8 + "% " + " Votos Brancos "
+ this.getNumeroEleitores() * 0.06 + "% " + " votos nulos "
+this.getNumeroEleitores() * 0.14 + "% ");
}
I have here the main method
public static void main(String[] args) {
AlgoritimoNumeroTotalPessoas antp = new AlgoritimoNumeroTotalPessoas(100);
antp.totalEleitores();
antp.calcularVotosTotal();
}
and here the console output below, how do I remove the points in the decimal place? and leave the output so 80%, 6%, 14%
Numero total de eleitores 100
votos validos 80.0% Votos Brancos 6.0% votos nulos 14.000000000000002%
I know there are some classes like format, Bigdecimal, but I didn’t know how to use this structure, because I’m beginner yet.
– Everson Souza de Araujo
What the method
getNumeroEleitores
returns?– Leonardo Villela
getNumeroElectors method is only a java bean of the numero attribute which is double type
– Everson Souza de Araujo