answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ladessa [460]
2 years ago
10

Write a recursive method called isReverse that accepts two strings as parameters and returns true if the two strings contain the

same sequence of characters as each other but in the opposite order (ignoring capitalization), and false otherwise. For example, the call of isReverse("hello", "eLLoH") would return true. The empty string, as well as any one-letter string, is considered to be its own reverse
Computers and Technology
1 answer:
Virty [35]2 years ago
3 0

Answer:

public static boolean isReverse(String s1, String s2)

{

if (s1.length() == 0 && s2.length() == 0)

{

return true;

}

else if (s1.length() == 0 || s2.length() == 0)

{

return false;

} else

{

String s1first = s1.substring(0, 1);

String s2last = s2.substring(s2.length() - 1);

return s1first.equalsIgnoreCase(s2last) &&

isReverse(s1.substring(1), s2.substring(0, s2.length() - 1));

}

}

public static boolean isReverse(String s1, String s2)

{

if (s1.length() != s2.length()) {

return false; // not same length

} else if (s1.length() == 0 && s2.length() == 0) {

return true;

} else

{

s1 = s1.toLowerCase();

s2 = s2.toLowerCase();

return s1.charAt(0) == s2.charAt(s2.length() - 1) &&

isReverse(s1.substring(1, s1.length()),

s2.substring(0, s2.length() - 1));

}

}

public static boolean isReverse(String s1, String s2)

{

if (s1.length() == s2.length())

{

return isReverse(s1.toLowerCase(), 0, s2.toLowerCase(), s2.length() - 1);

} else {

return false;

// not same length

}

}

private static boolean isReverse(String s1, int i1, String s2, int i2)

{

if (i1 >= s1.length() && i2 < 0) {

return true;

} else {

return s1.charAt(i1) == s2.charAt(i2) &&

isReverse(s1, i1 + 1, s2, i2 - 1);

}

}

public static boolean isReverse(String s1, String s2)

{

return reverse(s1.toLowerCase()).equals(s2.toLowerCase());

}

private static String reverse(String s)

{

if (s.length() == 0) {

return s;

} else {

return reverse(s.substring(1)) + s.charAt(0);

}

}

Explanation:

You might be interested in
The Tell Me feature also includes access to the _____ feature.
Ierofanga [76]

Answer:

the quick access toolbar can be customized to include additional commands such as. -"tell me what you want to do" box ... custom programs or additional commands that extend the functionality of a Microsoft office program ... in the open window. it also includes ribbon display options and control buttons that enable you to ...

Explanation:

7 0
2 years ago
Write the printitem() method for the base class. sample output for below program: last name: smith first and last name: bill jon
ella [17]
The question involves basic polymorphism. The following is the partial flow of the program.

baseItemPtr = new BaseItem();
baseItemPtr.setLastName("Smith");

derivedItemPtr = new DerivedItem();
derivedItemPtr.setLastName("Jones");
derivedItemPtr.setFirstName("Bill");

itemList.add(baseItemPtr);
itemList.add(derivedItemPtr);

for (i = 0; i < itemList.size(); ++i) {
itemList.get(i).printItem();
}

return;
7 0
2 years ago
Read 2 more answers
Write a for loop that prints the odd integers 11 through 121 inclusive, separated by spaces.
mixas84 [53]
The code for the above problem is:
<span>/* package whatever; // don't place package name! */ 

import java.util.*;
import java.lang.*;
import java.io.*; 

/* Name of the class has to be "Main" only if the class is public. */

class Ideone{ public static void main (String[] args) throws java.lang.Exception 
{ 
 for(int i=11; i<=121; i=i+2){
   System.out.print(i); System.out.print(" "); 
 } 
}<span>}

I hope this is the answer that you were looking for. </span></span>
4 0
2 years ago
Carrie is looking at the Form Properties Sheet. Which tab will control how the data is displayed and the data source it is bound
Lemur [1.5K]
The Answer is: Data


Hope this help
8 0
2 years ago
Respond to the following in a paragraph of no less than 125 words. Describe the steps to active listening.
Agata [3.3K]

Answer

• Maintaining eye contact

• Paying attention in the talk

• Listening without jumping to conclusion

• Formulating a picture in mind as you listen

• Avoid interruption to suggest solutions

• Asking clarification when the speaker has paused

• Asking questions to improve understanding

• Understanding the mood of the speaker

• Giving the appropriate feedback

Explanation

A person can improve his active listening skills by being aware of his or her personal style of communicating. A good listener is productive  and able to influence others when talking because he or she will have mastered the technique of persuading and negotiating with audience when talking. The journey to becoming an active listener is through paying attention, showing that you are following the speaker ,providing good feedback, avoiding judging the speaker and providing the appropriate feedback.



8 0
2 years ago
Read 2 more answers
Other questions:
  • Ruby is creating a presentation. She wants each slide displayed at intervals of five seconds. Which feature in the presentation
    6·2 answers
  • Which are examples of intrapersonal goals? Check all that apply. Lea plans to finish her next project before the due date. Erick
    12·2 answers
  • Modern operating systems decouple a process address space from the machine’s physical memory. List two advantages of this design
    15·1 answer
  • There are two methods of enforcing the rule that only one device can transmit. In the centralized method, one station is in cont
    5·1 answer
  • Based on virtualization technologies, how many types can we classify them? Please give a brief statement on each of them?
    14·1 answer
  • PC’s &amp; More has shifted to sales and service of laptops and PCs, where it has the potential to triple the number of its cust
    14·1 answer
  • Which of the following option is correct about HCatalog?
    14·1 answer
  • Nate wants to copy the style of his contact address to the normal template. Complete the paragraph to describe how he can access
    6·1 answer
  • Which two statements are true regarding online professional identity?
    10·1 answer
  • You are working on a documentation file userNotes.txt with some members of your software development team. Just before the file
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!