Jgrasp program- JAVA please help me with whole program. ive been struggling this
ID: 3617666 • Letter: J
Question
Jgrasp program- JAVAplease help me with whole program. ive been struggling this for 2days ! can anyone help me?
public static SumStack
{
public static void main(String [] args)
{
String A = 5 3 7 3
String B = 3 1 8
System.out.println(Stack<Integer>);
}
public static stack<Integer> Add(Stack<Integer> A,Stack<Integer> B)
Stack<Integer> c = new Stack<Integer>();
int c = 0;
while (!A.isEmpty() && ! B.isEmpty())
{
c = c + A.pop() + B.pop();
C.push(c % 10);
c = c/10;
}
}
That is what my professor wrote the method and i copied and i dontknow how to start in the main, and everything.
he said 3 loops in there.
for example A Stack:
3
7
3
5 (which it means5373)
for B Stack:
8
1
3 (which it means 318)
all altogether 5373 + 318 = 5691
Perform: C = A + B
Display: C
anyone help
? thanks!!!