1answer.
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
Juliette [100K]
3 years ago
13

Write a method that checks whether the input string or a sentence (a string with spaces) is a palindrome or not. The method shou

ld be case insensitive and should ignore spaces. Write a test program that prompts the user to input a string and invokes this method. Some example runs are: Enter the input string: madam Input string madam is a palindrome Enter the input string: banana Input string banana is NOT a palindrome Enter the input string: Race Car Input string Race Car is a palindrome Enter the input string: Too HOT to hoot Input string Too HOT to hoot is a palindrome
Computers and Technology
1 answer:
AURORKA [14]3 years ago
5 0

Answer:

import java.util.Scanner;

public class Pallindrome {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter the input string: ");

       String word = in.nextLine();

       System.out.println(isPallindrome(word));

   }

   public static String isPallindrome(String word){

       String rev ="";

       int len = word.length();

       for ( int i = len - 1; i >= 0; i-- )

           rev = rev + word.charAt(i);

       if (word.equals(rev))

           return word+" is palindrome";

       else

           return word+ " is not palindrome";

   }

}

Explanation:

  • Create the method in Java to receive a String parameter
  • Using a for loop reverse the string
  • Use another for loop to compare the characters of the original string and the reversed string
  • If they are equal print palindrome
  • else print not palindrome
  • Within the main method prompt user for a sentence
  • Call the method and pass the sentence entered by user
You might be interested in
How can i address inv file in c for open it?
Paul [167]
Launch a .inv file, or any other file on your PC, by double-clicking it. If your file associations are set up correctly, the application that's meant to open your .inv file will open it.
Or else
With a extension?
5 0
3 years ago
Which button could Pamela press in the Microsoft Word spell checker to make the word “colour” instantly change to “color” whenev
Savatey [412]
One step is to right click on the word to add it to her personal dictionary. or, <span><span>Press F7. Word starts the spelling and grammar checking utility. </span><span>Make corrections, as appropriate, when prompted.
</span></span>

However, one can create a macro that would do the conversions :

1) Identify a list of words whose spelling you want to convert.2) Turn on the macro recorder. 3) Use the Replace feature to replace the spellings.4) Turn off the macro recorder.

The macro will do a conversion from one to the other. Later, as we have more words that need to be automatically replaced, we can just edit the macro and add those words.

8 0
3 years ago
What does a blinking yelow light mean on a phillips sonicare toothbrush
babunello [35]

Answer:

it means that you need to charge it or change the batteries depending on what kind you have

3 0
2 years ago
To reduce costs and the environmental impact of commuting, your company decides to close a number of offices and to provide supp
kkurt [141]

Answer:

The description including its query is provided throughout the section of the elaboration elsewhere here.

Explanation:

  • Coordination between teams is the main challenge that this new strategy can make. Agile creation is focused on the teamwork of cross-functional teams, where every other mission is identified and distinct teams are formed. All the departments collaborate and afterward work in stages until the completion of this research project.
  • Unless the organization shuts several departments, contact with various teams and peers will be disrupted and contact differences with workers as well as the team would be established.
  • The best approach will be to provide regular communication calls with multiple project managers such that each project stage is synchronized. In turn, this same project coordinator should always have numerous calls with his group members to even get construction progress.
6 0
3 years ago
Consider the helicopter of Example 2.1, but with a slightly different definition of the input and output. Suppose that, as in th
anzhelika [568]

Answer:

Solution: In this case, the system can be modeled as a function with two output signals,

S: (R  --> R) --> (R --> R)^{2}

where

(S(T_{y}))(t) = (x(t), y(t))

where(x(t), y(t)) is the position of the tail in they plane. This model Is Clearly not linear. If the  Input torque doubles, for example, the output values will not double. In fact, the output values are constrained to lie on a circle centered at the origin, regardless of the Input. For this reason, the model is BIBO stable. The output is always bounded. Thus, while our previous model was linear and unstable, this one Is nonlinear and stable. Which model is more useful?

3 0
3 years ago
Other questions:
  • A block style business letter is:
    5·1 answer
  • Terms that represents the achual speed used by device to transfer data​
    14·1 answer
  • Communications technology and the Internet can be used to reduce the time and costs involved in disseminating financial statemen
    14·1 answer
  • Is the jane austen pride and prejudie a primary source
    6·1 answer
  • How did the internet originate??​
    12·1 answer
  • What would a system unit that is integrated with the display and keyboard would be considered?
    6·1 answer
  • 3. Which property provided the labels in the list below?
    9·1 answer
  • I need it in code please (python)
    15·2 answers
  • Which of the following is NOT AN EXAMPLE of personal identifying
    9·2 answers
  • What is one of the advantages of using an algorithm to solve a puzzle like Kriss-Kross or Sudoku?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!