Question: Write a recursive method called doubleDigits that accepts an integer n as a parameter and returns the integer obtained by replacing every digit of with

Write a recursive method called doubleDigits that accepts an integer n as a parameter and returns the integer obtained by replacing every digit of with two of that digit. For example, doubleDigits(348) should return 334488. The call doubleDigits(0) should return 0. Calling doubleDigits on a negative number should return the negation of calling doubleDigits on the corresponding positive number; for example, doubleDigits(–789) should return –778899.

Step by Step Solution

3.28 Rating (166 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public static int doubleDigits int n ... View full answer

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 Building Java Programs A Back to Basics Approach Questions!