Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

NEED HELP Write a method called stackSum that returns an int and has no parameters which will find the sum of a stack using a

image text in transcribed

NEED HELP

"Write a method called stackSum that returns an int and has no parameters which will find the sum of a stack using a recursive technique and leave the stack unchanged. Test the method in a driver program with the following items pushed onto a stack in the following hardcoded order: -6, 4, 2, 10, 8. The output of the program should display the sum in a message to the console. Assume the method is a member of a linked stack class called LinkedStack that has a private data member: top, and methods: getInfo() and getLink(). The data member top is of type: LSNode (linked stack node), and each LSnode has data members: info and link-" The following rubric will be used: 1. Create the basic template common to all Java programs. 2. Give the correct signature for the specified method/function. 3. Access the calling object's stack. 4. Effectively accesses the data members and methods. 5. Implement a base case and recursive case in the solution. 6. Effectively return the correct sum of a stack using recursion. 7. Leave the calling object's stack unchanged. 8. Test the recursive function/method using a main driver. 9. Check the program for errors and omissions and debug. 10. Successfully execute the file with the appropriate output to the console. A score of 5, for example, would mean the program demonstrated 5 out of the 10 objectives

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions

Question

5. Describe the relationship between history and identity.

Answered: 1 week ago

Question

=+Have they changed the way employees view IP?

Answered: 1 week ago