How to calculate interest and discount on a line?

Asked

Viewed 88 times

2

On my button I declared so:

numero_de_parcelas = Integer.parseInt(txtNumeroParcelas.getText());
juros = Float.parseFloat(txtJuros.getText());
desconto = Float.parseFloat(txtDesconto.getText());
valor_da_venda = Float.parseFloat(txtValorVenda.getText());
valor_da_parcela = valor_da_venda / numero_de_parcelas;

But when I show the total in the table with interest and discounts does not work my calculation:

Mparcela.setPreco_parcelas((valor_da_parcela+(valor_da_parcela*
    (juros/100)))-(valor_da_parcela-((valor_da_parcela*(desconto/100)))));
          mp.setPreco_total(Float.parseFloat(txtTotal.getText()));

It only works the interest alone when I leave like this:

Mparcela.setPreco_parcelas(valor_da_parcela+(valor_da_parcela*(juros/100)));
mp.setPreco_total(Float.parseFloat(txtTotal.getText()));

But the discount I don’t know how to do...

Does anyone know?

  • Textbox? I’ve never seen this in Java. No would jtextfield?

  • Yes! Excuse me, excuse me...

  • So: mp.setPreco_parcelas((valor_da_parcela+(valor_da_parcela*(juros/100)))-(valor_da_parcela+((valor_da_parcela*(desconto/100)));no young man, now he brought me a negative number

  • 1

    (valor_da_parcela+(valor_da_parcela*juros/100))-(valor_da_parcela*desconto/100), confirm on Ideone

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.