Boa noite gente, to meio enrolado aqui com um trabalho, por favor, me ajudem a transformar esse código portugol em java:
<strong>ALGORITMO DA TRANSAÇÃO DE VENDA: CADASTRAR VENDA</strong>
<strong>Início do Programa INCLUIR_VENDA;</strong>
***** OBTER DADOS JUNTO AO USUÁRIO *****
<strong>Ler CodCli, Codprod, CodLocal, Quantidade</strong>
***** TRATAR ESTOQUE E A EXISTÊNCIA DO PRODUTO *****
<strong>EXEC SQL SELECT descricao, local_fab, qtd_estoque, preco_unitario</strong>
<strong>From Produto Where Codprod = :Xcodprod</strong>
<strong>Se SQL Not Ok! então</strong>
<strong>Escreva “Produto não encontrado!”;</strong>
<strong>Sair;</strong>
<strong>Fim se</strong>
<strong>Se (qtd_estoque < Quantidade) então</strong>
<strong>Escreva “Produto sem estoque!”;</strong>
<strong>Sair;</strong>
<strong>Fim se</strong>
<strong>EXEC SQL UPDATE Produto set qtd_estoque = qtd_estoque - :QuantidadeVendida</strong>
<strong>WHERE Codprod = :Xcodprod;</strong>
***** CALCULAR O PREÇO TOTAL *****
<strong>total = total + (Quantidade * preço);</strong>
<strong>Escreva “Preço calculado: ”, total</strong>
***** CALCULAR DESCONTO 1: Com base no bônus e na tabela de Descontos *****
<strong>EXEC SQL EXECUTE</strong>
<strong>BEGIN</strong>
<strong>total CALCULAR_DESCONTO(CodProd, CodCli, Quantidade: Inteiro; Total: Real): Real;</strong>
<strong>END;</strong>
<strong>END-EXEC</strong>
***** CALCULAR DESCONTO 2: Compras no mesmo local de fabricação tem 10% de desconto *****
<strong>Se (CodLocal = LNPROD) então</strong>
<strong>total = total – (total * 10/100);</strong>
<strong>Escreva “Valor calculado da venda: ”, total;</strong>
<strong>Fim se</strong>
***** GRAVAR VENDA *****
<strong>EXEC SQL INSERT INTO Venda (CodCli, CodProd, CodLocal, Qtd_venda, valor_total, data_venda)</strong>
<strong>VALUES (:XCodcli, :XCodPro, :XCodLocal, :XQuantidade, :Xtotal, :Xdatasistema);</strong>
<strong>Se SQL = OK então</strong>
<strong>Escreva “Venda incluída com sucesso!”;</strong>
<strong>Exec SQL Commit;</strong>
<strong>Senão</strong>
<strong>Escreva “Erro na gravação da venda!”;</strong>
<strong>Exec SQL Rollback;</strong>
<strong>Fim se</strong>
***** LISTAR ITENS VENDIDOS *****
<strong>EXEC SQL SELECT b.descricao, a.Qtd_venda, a.preco_unitario, a.valor_total</strong>
<strong>From Venda a, Produto b, Cliente c</strong>
<strong>Where a.Codprod = b.CodProd</strong>
<strong>And c.CodCli = :Xcodcli;</strong>
<strong>Fim do Programa INCLUIR_VENDA</strong>
<strong>ALGORITMO DA TRANSAÇÃO DE VENDA: EXCLUIR VENDA</strong>
***** DELETAR VENDA *****
<strong>Ler codcli, codprod, dt_venda</strong>
<strong>Exec SQL Select Total Into VTOT, QTDE Into VQTDE</strong>
<strong>Codlocal Into Vlocalvenda</strong>
<strong>From Venda</strong>
<strong>Where codcli = :codcli And codpro = :codprod and</strong>
<strong>Datavenda = :dt_venda FOR UPDATE;</strong>
<strong>Se SQLCA.SQLCODE != 0 then</strong>
<strong>Escreva “Venda Inexistente!”;</strong>
<strong>Exec SQL Rollback;</strong>
<strong>Continue;</strong>
<strong>Fim se;</strong>
***** TRATAR ESTOQUE *****
<strong>Exec SQL Update Produto SET QTDE = QTDE + VQTDE</strong>
<strong>Where PN = :codProd;</strong>
<strong>Se SQLCA.SQLCOD != 0 then</strong>
<strong>Exec SQL Rollback;</strong>
<strong>Continue;</strong>
<strong>Fim se;</strong>
***** DEVOLVER BONUS DO CLIENTE *****
<strong>Exec SQL Select precounitario Into VPRECO, codlocal Into Vlocalprod</strong>
<strong>From produto Where PN = :codpro;</strong>
<strong>VLRTOTALREAL = VPRECO * VQTDE;</strong>
<strong>Se Vlocalvenda == Vlocalprod then</strong>
<strong>VLRDESCLOCAL = VLRTOTALREAL * 0.10;</strong>
<strong>VTOT = :VTOT + VLRDESCLOCAL;</strong>
<strong>Fim se;</strong>
<strong>Exec SQL Update Cliente SET BONUS = BONUS + 100</strong>
<strong>Where CN = :codcli And :VTOT < :VLRTOTALREAL;</strong>
***** DELETAR A VENDA *****
<strong>Exec SQL Delete From Venda Where cód_cli = :codcli and datavenda = :dt_venda;</strong>
<strong>Se SQLCA.SQLCODE != 0 then</strong>
<strong>Escreva “Venda não excluída”!</strong>
<strong>Exec SQL Rollback;</strong>
<strong>Continue;</strong>
<strong>Else</strong>
<strong>Escreva “Venda excluída com sucesso!”;</strong>
<strong>Exec SQL Commit;</strong>
<strong>Fim se;</strong>
<strong>2) Regra para a construção da Function CALCULAR_DESCONTO</strong>
<strong>Clientes que possuem mais de 100 pontos de bônus tem direito a um desconto, e caso ganhe o</strong>
<strong>desconto pagará 100 pontos de seus bônus. Produtos com descontos são aqueles que estão na tabela</strong>
<strong>desconto com uma determinada quantidade.</strong>
<strong>Classe/Tabela: DESCONTO</strong>
<strong>Atributo Tipo Chaves e descrições</strong>
<strong>ID_DESCONTO Autonumeração (PK)</strong>
<strong>CODPROD Numero (FK)</strong>
<strong>PERCENTUAL Numero Percentual de desconto Ex: 2, 8, 10, 12…</strong>
<strong>QTD_MIN Numero Quantidade mínima para desconto < QTD_MAX</strong>
<strong>QTD_MAX Numero Quantidade máxima para desconto > QTD_MIN</strong>
<strong>Observação:</strong>
<strong>Os produtos podem se repetir, pois terão descontos diferentes para uma determinada quantidade.</strong>
<strong>ALGORITMO DA FUNÇÃO: CALCULAR_DESCONTO</strong>
<strong>FUNCTION CALCULAR_DESCONTO (CodProd, CodCli, Quantidade: Inteiro; Total: Real): Real;</strong>
<strong>INÍCIO DA FUNCTION</strong>
<strong>EXEC SQL SELECT Bonus</strong>
<strong>From Cliente</strong>
<strong>Where Codcli = :Xcodcli;</strong>
<strong>Se Bonus >= 100 então</strong>
<strong>EXEC SQL SELECT Percentual</strong>
<strong>From Desconto</strong>
<strong>Where CodProd = :Xcodpro AND</strong>
<strong>Qtd_min >= :XQuantidade AND Qtd_max <= :XQuantidade;</strong>
<strong>Se SQL OK! então</strong>
<strong>Retorne valor_total – (valor_total * Percentual/100);</strong>
<strong>EXEC SQL UPDATE Cliente SET Bonus = Bonus - 100</strong>
<strong>Where Codcli = :Xcodcli;</strong>
<strong>Fim se</strong>
<strong>senão</strong>
<strong>Escreva “Cliente não possuirá desconto!”;</strong>
<strong>Fim se</strong>
<strong>FIM DA FUNCTION</strong>