Question: if i had a stack that takes array String of item with it price how would i create a method that sum the prices to
this is the out put of view cart 
3] 4- enter the prize withdraw -2 exit 2. Customer cart: 1- bread 0.5 2- toast 1.0 3- lettuce 2.3 4- apple 2.1 5- orange 1.7 6- lettuce 2.3 7- gummy bear 1.8 8- cookie 2.0 Customer list of command 1- buy 2- see cart 3- checkout 4- enter the prize withdraw -2 exit 4 5 6 8 9 class Stack int top=-1; String arr[]; double price[]; Stack() { arr=new String(100); 11 12 13 } 15 160 28 void printStack (D void push (String a) { arr[++top]=a ; } String pop () { if (top>-1) { return arr[top--]; } return ""; 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 boolean isEmpty() if (top==-1) return true; return false; } // end Stack class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
