I have a project in Netbeans based on MVC. In the part of the "ABMProduct" view, I have the following code:
private void txtGananciaActionPerformed(java.awt.event.ActionEvent evt) {
float pv = 0, pc = 0, pg;
pc = Float.parseFloat(txtPrecioCompra.getText());
pg = (pc * Float.parseFloat(txtGanancia.getText())) / 100;
pv = pc + pg;
txtPrecioVenta.setText(String.valueOf(pv));
}
Basically what it does is: I give it a purchase price, I give it a profit and based on that, it calculates the sale price.
What I want to do is that the sale price is rounded to a maximum of 0.00
What can I do? Thanks!