Question: I need assistance with the following Java code Create a class named Ex4_1 , with the following static methods in it: A method displayRowOfCharacters that

I need assistance with the following Java code

Create a class named Ex4_1, with the following static methods in it:

A method displayRowOfCharacters that displays any given character the specified number of times on one line. For example, the call

displayRowOfCharacters('*', 5);

produces the line

*****

Implement this method using recursion.

A method, getInput, that asks the user for integer input that is between 1 and 10, inclusive. If the input is out of range, the method should recursively ask the user to enter a new input value.

A palindrome is a string that reads the same forward and backward. For example deed and level are palindromes. You did implement a similar method in exercise 3, however in this one you can assume that input string will only consist of lowercase letters, and that parameter won't be null. Implement a recursive method isPalindrome.

If n is positive integer in Java, n%10 is its rightmost digit and n/10 is the integer obtained by dropping the rightmost digit from n. Using these facts, write a recursive method, named displayDigits, that displays an integer n in decimal.

You need to use the template provided below

public class Ex4_1

{

public static void main(String... args)

{

displayDigits(12345); // displays 1.2.3.4.5.

}

public static void displayRowOfCharacters(char c, int n)

{

// Needs to be implemented

// You can assume n is positive, i.e., n>=1.

}

public static int getInput(Scanner keyboard)

{

// Needs to be implemented

}

public static boolean isPalindrome(String str)

{

// Needs to be implemented

}

public static void displayDigits(int n)

{

// Needs to be implemented

// You can assume n is positive, i.e., n>=1.

}

}

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!