Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Ai And The Lottery Defying Odds With Intelligent Prediction

Authors: Gary Covella Ph D

1st Edition

B0CND1ZB98, 979-8223302568

More Books

Students also viewed these Databases questions

Question

5) Determine if the variables are independent. Pg45

Answered: 1 week ago

Question

If ( A^2 - A + I = 0 ), then inverse of matrix ( A ) is?

Answered: 1 week ago

Question

What is computer neworking ?

Answered: 1 week ago

Question

Describe the seven standard parts of a letter.

Answered: 1 week ago

Question

Explain how to develop effective Internet-based messages.

Answered: 1 week ago

Question

Identify the advantages and disadvantages of written messages.

Answered: 1 week ago