Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a new project called Conversion and save it in the appropriate Lab folder . Step 1: design and code a program that uses a

Create a new project called Conversion and save it in the appropriate Lab folder.

Step 1: design and code a program that uses a recursive method to convert a String of digit characters into an integer variable. For example, convert the character string 13531 to an integer with the value 13,531. Note that the comma is present only to distinguish the integer value from the character string (in quotes) . The program should be repetitive to allow the user to enter any number of number strings, convertthem, display them, and sum them.

When the user enters a sentinel value to terminate the input, display the sumand the calculated average of the numbers entered with one (1) decimalplace.

To avoid the possibility of an overflow error, you may limit the String to eight (8) characters.

Step 2: design the recursive method to take in a number string as a parameterand return its integer value. The solution must be the result of the recursive process. It must NOT use an iterative process to obtain the return value. You are not allowed to use any method or function from the Java API or C++ STL. You must do the "parsing" in your own code in your own recursive method.

Remember, a recursive processobtains its results by calling itselfrepeatedly with differing values from theprevious call. It ends (returns its result) when its input parameter detects the value of the base case. In this instance, the base case is when all the character digits have been converted.

There are two (2) methods that can easily be used in this process:

  • One is by decreasing the power of ten multiple when moving from the leftmost character to the right.
  • The other is to increase the sum by ten on each iteration before adding the current character (moving from left to right).

Step 3: Using the JAVADOC format, document the program and everymethod (main is a method, not a constructor) as displayed in the sampleprograms found in the downloaded filesfor classroom activity. Completeness, accuracy, and spelling count.

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

5. Identify three characteristics of the dialectical approach.

Answered: 1 week ago

Question

7. Identify six intercultural communication dialectics.

Answered: 1 week ago