Inventory.java 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * Write a description of class Inventory here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. import java.util.Scanner;
  8. //
  9. public class Inventory extends ProductItem {
  10. //Show item
  11. public void printitem()
  12. {
  13. super.outputid();
  14. super.outputquantity();
  15. super.outputpr();
  16. }
  17. //create item
  18. public ProductItem itemcreation()
  19. {
  20. ProductItem newitem = new ProductItem();
  21. Scanner keyboard = new Scanner (System.in);
  22. int newid;
  23. System.out.println("Enter new value for ID: ");
  24. super.setid(newid= keyboard.nextInt());
  25. int newquantity;
  26. System.out.println("Enter new value for Quantity: ");
  27. super.setquantity(newquantity= keyboard.nextInt());
  28. int newprice;
  29. System.out.println("Enter new value for Price: ");
  30. super.setpr(newprice= keyboard.nextInt());
  31. return newitem;
  32. }
  33. // public int getTotalQuantity(){
  34. // //go through each product
  35. // for (Productitem P : productitem){
  36. // //get quantity from product
  37. // //add them all up
  38. // total +=p.getQuantity();
  39. // }
  40. // return total;
  41. }
  42. //edit item