Advertisement
homeworkhelp111

Untitled

Apr 14th, 2023
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. public static void addStock(Product[] products, Scanner sc) {
  2. int num=-1;
  3. System.out.println("How many values do you want to add: ");
  4. num = sc.nextInt();
  5.  
  6. while(num < 0) {
  7. System.out.println("Please enter only positive values!");
  8. System.out.println("How many values do you want to add: ");
  9. num = sc.nextInt();
  10. }
  11. for(int i=0; i<index; i++) {
  12. products[i].addQuantity(num);
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement