Calcular juros

1 resposta
A
Como eu faco p calcular o juros de uma mensalidade utilizando o codigo abaixo e retornar o resultado para um JTextfield como String.] Agradeco desde ja se puderem ajudar.
if(E.getActionCommand().equals("Calcular")){


			C.setNome(nome.getText());
			C.setMatricula(matricula.getText());
			C.setDocumento(documento.getText());
			C.setNumerocartao(numerocartao.getText());
			C.setBandeira((String)bandeira.getSelectedItem());
			C.setStatus(status.getText());
			C.setFormapagamento((String)formapagamento.getSelectedItem());				C.setValor(Double.parseDouble(valor.getText()));
	                                C.setDesconto(Double.parseDouble(desconto.getText()));
	    	                 C.setTotal(Double.parseDouble(total.getText()));
	C.setVdd(Vdd.getSelectedItem());
		C.setVmm((Integer)Vmm.getSelectedItem());
			C.setVaaaa((Integer)Vaaaa.getSelectedItem());
			C.setPdd((Integer)Pdd.getSelectedItem());
			C.setPmm((Integer)Pmm.getSelectedItem();
			C.setPaaaa((Integer)Paaaa.getSelectedItem());
			
if ( C.getPdd()>C.getVdd()){
				
				total2=C.getValor()*1.20;
JOptionPane.showMessageDialog(null, total2, null, 0); } else { JOptionPane.showMessageDialog(null, "erro", null, 0); }

1 Resposta

pedromuyala

Explica melhor o que fazem esses métodos abaixo: :?:

C.setVdd(Vdd.getSelectedItem());
C.setVmm((Integer)Vmm.getSelectedItem());
C.setVaaaa((Integer)Vaaaa.getSelectedItem());
C.setPdd((Integer)Pdd.getSelectedItem());
C.setPmm((Integer)Pmm.getSelectedItem();
C.setPaaaa((Integer)Paaaa.getSelectedItem());

Mas adianto, para calcular o juros: total2 = C.getValorTotal() * juros (1.05, 1.20, …)
E para setar o JTextField, use: [color=red]seutextfield[/color].setText(total2);

Espero ter ajudado. :wink:

Criado 8 de junho de 2009
Ultima resposta 8 de jun. de 2009
Respostas 1
Participantes 2