Well, I do not know if I can ask for help in relation to the calculation, but anyway, my question is:
I need to do the skinfold calculation, in this case the calculation of Pollok 3 folds, I researched the internet, but it is not so easy to understand, I wonder if the way I'm doing this is correct. I was just going to post the calculation, but I also did an executable example (very simple example) to be able to illustrate the situation better.
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: link
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