Question: Can someone please help rewrite the below java program in two versions? One should be recursive and the other should be 'not recursive. import java.util.Scanner;

Can someone please help rewrite the below java program in two versions? One should be recursive and the other should be 'not recursive.

import java.util.Scanner;

public class FunctionDemo {

public static void main(String[] args) { Scanner in = new Scanner(System.in);

System.out.printf("Enter a string: "); String str = in.nextLine();

System.out.printf("The string you entered has %d charcters. ", str.length()); System.out.printf("The first character is: %c. ", str.charAt(0));

int value = str.charAt(0); System.out.printf("The ASCII value of this character is %d. ", value); System.out.printf("The square root of %d is %f. ", value, Math.sqrt(value));

System.out.printf("Convert the string to all upper case: %s ", str.toUpperCase()); System.out.printf("Convert the string to all lower case: %s ", str.toLowerCase());

in.close(); }

}

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!