Write a Java public static general function which doesn't belong to the Stack class, isGreaterThan that determines if one stack is greater than another stack. If the summation of every other...


Write a Java public static general function which doesn't belong to the Stack class,isGreaterThan that determines if one stack is greater than another stack.  If the summation of every other item(starting at the top) from one stack is greater than the summation of every other item(starting at the top) from another, return true, otherwise, return false.  After you call this method,both stacks should stay the same as they are called before.


     Receives:a Stacktype argument S1 and another Stack type argument S2

     Postcondition:  If the summation of every other item (starting at the top) from S1 is greater than the summation of every other item (starting at the top) from S2, return true, otherwise, return false. Both S1 and S2 should stay the same as they are called before.


 public static boolean isGreaterThan(Stack S1, Stack S2)



Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here