2
Well, I don’t know if I can ask for help in calculating, more anyway, my question is this::
I need to do the calculation of skin folds, in this case the calculation of Pollok 3 folds, I researched on the internet, but it is not something so easy to understand, I would like to know, if the way I am doing this correct. I was going to post only the calculation, but I also made an executable example (very simple example) to illustrate the better situation.
I used this information as a basis:
Para 3 dobras:
DC= 1,10938 – 0,0008267 (X2) + 0,0000016 (X2)
2 – 0, 0002574 (X3)
Legenda:
DC= Densidade Corporal em g/ml
X2 = soma das 3 dobras (tórax, abdominal e coxa)
X3 = idade em anos
Note: page 36 : https://sandrodesouza.files.wordpress.com/2010/05/perimetria-dobras-cutaneas-e-protocolos.pdf
Code:
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class DobrasCuteneas extends JFrame {
JTextField campoPeitoral = new JTextField();
JTextField campoAbdominal = new JTextField();
JTextField campoCoxa = new JTextField();
JTextField campoGorduraIdeal = new JTextField();
JButton botao = new JButton("Calcular");
public DobrasCuteneas() {
setTitle("Exemplo");
add(tela());
pack();
acaoBotao();
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
private void acaoBotao() {
botao.addActionListener((ActionEvent ae)
-> {
calculo();
});
}
private JPanel tela() {
JPanel painel = new JPanel();
JLabel label01 = new JLabel("Peitoral:");
painel.add(label01);
painel.add(campoPeitoral);
campoPeitoral.setPreferredSize(new Dimension(100, 20));
JLabel label02 = new JLabel("Abdominal:");
painel.add(label02);
painel.add(campoAbdominal);
campoAbdominal.setPreferredSize(new Dimension(100, 20));
JLabel label03 = new JLabel("Coxa:");
painel.add(label03);
painel.add(campoCoxa);
campoCoxa.setPreferredSize(new Dimension(100, 20));
painel.add(botao);
botao.setPreferredSize(new Dimension(90, 20));
JLabel label04 = new JLabel("Gordura ideal:");
painel.add(label04);
painel.add(campoGorduraIdeal);
campoGorduraIdeal.setPreferredSize(new Dimension(100, 20));
add(painel);
return painel;
}
private void calculo() {
float peitoral = Float.valueOf(campoPeitoral.getText().replaceAll(",", "."));
float abdominal = Float.valueOf(campoAbdominal.getText().replaceAll(",", "."));
float coxa = Float.valueOf(campoCoxa.getText().replaceAll(",", "."));
float idade = 25;
Float x2 = (peitoral + abdominal + coxa);
Float densidadeCorporal = (float) (1.10938 - x2) + (x2 * 2) - idade;
System.out.println("Densidade corporal: " + densidadeCorporal);
Float percentualGordura = ((float) ((4.95 / densidadeCorporal) - 4.50) * 100);
System.out.println("Percentual de gordura: " + percentualGordura);
campoGorduraIdeal.setText("" + percentualGordura);
}
public static void main(String[] args) {
EventQueue.invokeLater(()
-> {
DobrasCuteneas dobras = new DobrasCuteneas();
dobras.setVisible(true);
});
}
}
And for the final calculation (ideal fat) :
%G = [(4,95/Densidade Corporal) - 4,50] x 100
In this case, he ends up returning me values like -421,000 for example, I believe that this is not correct.
– Gustavo Santos
@Gustavosantos In fact there was also a missing coefficient for the
idade
. Confirm now if you get the expected values– Isac