Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void searchItem() {
- String n = JOptionPane.showInputDialog("Enter name to search:");
- String msg = "";
- boolean found = false;
- for(int i=0;i<rb.length;i++)
- {
- if(rb[i].name.equalsIgnoreCase(n))
- {
- feature p = (feature) rb[i];
- msg = "Product Name: " + p.name;
- msg += "\n" + "Product Number: " + p.number;
- msg += "\n" + "Number of Product in Stock: " + p.quantity;
- msg += "\n" + "Item Price: " + new java.text.DecimalFormat("$0.00").format(p.price);
- msg += "\n" + "Item Restock Fee: " + new java.text.DecimalFormat("$0.00").format(p.restockFee());
- msg += "\n" + "Inventory Value: " + new java.text.DecimalFormat("$0.00").format(p.InventoryValue());
- JOptionPane.showMessageDialog(null, msg);
- found = true;
- break;
- }
- }
- if (found == false) {
- JOptionPane.showMessageDialog(null, "Not found");
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement