pessoal eu queria saber como que eu somo apenas o preco dos ingredientes incluidos na lista!
private void btnIngredientesActionPerformed(java.awt.event.ActionEvent evt) {
String qu = ((JOptionPane.showInputDialog(null, “Informe a quantidade de ingredientes”)));
int q = Integer.parseInt(qu);
for (int j = 0; j < q; j++) {
Ingrediente i = new Ingrediente();
i.setNome(JOptionPane.showInputDialog(null, "Nome do ingrediente: "));
i.setQtd(Double.valueOf(JOptionPane.showInputDialog(null, “Quantidade(ml/g):”)));
i.setPreco(Double.valueOf(JOptionPane.showInputDialog(null, “Valor do ingrediente(R$):”)));
ingredientes.add(i);
}
}