how to let the user select from an objects list with any quantity and subtract them from the list

Viewed 30

I need to create a store program that lets the user select as many products they desire as long as it does exist in the list and then remove them from the list

  public static void removeProduct(String[] list, int removedIdx) {
        System.arraycopy(list, removedIdx + 1, list, removedIdx, list.length - 1 - removedIdx);
    }

    public double total(){
        //...
        removeProduct();
    }

also, I'm not sure whether the removeProduct method is suitable for this kind of problem...

0 Answers
Related