Question: Tony Gladdis; Starting out With Java 4 th Edition - Chapter 1 5 Programming Challenge A Add - a - String ( Would like this

Tony Gladdis; Starting out With Java 4th Edition - Chapter 15 Programming Challenge A Add-a-String (Would like this coded and is able to complie and run without error, please)
Specifications:
Write a recursive program that accepts an alphanumeric String argument and returns the sum of each of its characters. The alpha characters are equal to their placement in the ordered alphabet, e.g., A=1, a=1, C=3, e=5, etc.; and numerals are equal to their corresponding number, e.g.,1=1.
For example, the string 1Bz6 would equal 35 because 1+2+26+6=35 The direct (brutal) approach to recursion would result in the calling sequence bottoming out at N call levels deep. That is, for a string of N characters, when the recursion starts to unwind, it would have called itself N times, and there would be (N-1)hanging method calls waiting for return values. This can get resource expensive. However, there are ways to reduce this depth, so that processing is never anywhere near N levels deep for non-trivial values of N.
Write your recursive code in such a way that processing never goes more than 70% of N. For example, for a string of 10 characters, each of them is processed using recursion, but processing is never more than 6 levels deep. (This is not needed but would be greatly appreciated if added, thank you!)

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!