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

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 get the total out of that string
if i had a stack that takes array String of item with this is the out put of view cart
i want when i click on checkout to sum the prices
this is my stack
it price how would i create a method that sum the prices
it push a string with double the price how do i manage to seperate them to sum the prices

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!