Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Needing to compare my new files Recursive.java which contains the details of creating the 4 methods as specified above: int sum_sqr_rec(stack stk),(15 points) int plus_minus_rec(stack
Needing to compare my new files
- Recursive.java which contains the details of creating the 4 methods as specified above:
- int sum_sqr_rec(stack stk),(15 points)
- int plus_minus_rec(stack stk),(15 points)
- void prt_chars_rev_rec(stack stk),(15 points)
- void prt_chars_rec(queue stk),(15 points)
- RecursiveDemo.java which:
- A- reads a string expression:
- {(1+2)+[4*(2+3)]}
- and store the expression in a stack and a queue.(15 points)
- a- prints the corresponding expression "in reverse" using: prt_chars_rev_rec ( 5 points)
- b- prints the corresponding expressing "as is" using: prt_chars_rec.( 5 points)
- B- reads an array of integers: { 1, 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 }
- and store them in a stack of ints.(5 points)
- Then it:
- C- prints the sum of the squares of the elements in the stack usingint sum_sqr_rec(stack stk) and outputting the value(5 points):
- 385
- D- prints the sum of the elements in the stack using:
- intplus_minus_rec(stack stk)and outputting the value(5 points):
- 1 - 2 + 3 - 4 + 5 - 6 + 7 - 8 + 9 - 10 = -5
- A- reads a string expression:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To help you with the implementation of Recursivejava and RecursiveDemojava I will outline the details for creating the methods as per the problem statement This will include the method signatures how ...
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started