Add files via upload

This commit is contained in:
Aesthetiful authored and GitHub committed 2024-03-21 11:45:04 -07:00
1 parent a522d70e6d
commit a09f45a2a4
5 files changed
+132 -11

No files matched your search

+7 -11
View File
@@ -11,24 +11,20 @@ public class Warehouse
* @param orderQuant the quantity requested of this product
* @return true if the order is completed; false otherwise.
*/
public boolean fulfillOrder(String code, int orderQuant)
{
/* Implement your answer to part (a) here */
for(Product[] row : stock) {
for(Product p : row) {
if(p.getProductCode().equals(code)) {
if(p.getQuant() >= orderQuant) {
public boolean fulfillOrder(String code, int orderQuant) {
for (Product[] row : stock) {
for (Product p : row) {
if (p.getProductCode().equals(code)) {
if (p.getQuant() >= orderQuant) {
p.setQuant(p.getQuant() - orderQuant);
return true;
} else {
return false;
}
} else {
return false;
}
}
}
return false;
}
@@ -44,4 +40,4 @@ public class Warehouse
public Warehouse(Product[][] s)
{ stock = s; }
}
}