I have here a piece of code that is designed to display text if one number is less than another. when running the sequence, despite both numbers being 1 and the boolean returning a false, the IF statement still runs, although it should only run if its argument returns as true. Can anyone identify why this is happening?
public void displayReorders(javax.swing.JTextArea src){
src.setText(null);
for(Product product: this.Products){
if((reorderChecker(product.getQuantity(), product.getMinimumStockLevel()))==true);
{
src.append("Product: " + product.getName()+"\n");
src.append("Quantity: " + product.getQuantity()+"\n");
src.append("Min Restock amount: " + (product.getMinimumStockLevel()-product.getQuantity())+"\n");
}
}
}
public boolean reorderChecker (int quantity, int minimumStockLevel){
boolean reorderRequired = false;
if (quantity < minimumStockLevel) {
reorderRequired = true;
}
return reorderRequired;
}
Any help is very much appreciated!
Aucun commentaire:
Enregistrer un commentaire