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
What was the first carbonated drink to be introduced in the US?
adelina 88 [10]
Taco bell...........................................................................................................................................................................

6 0
3 years ago
The browser feature which enables tabs to work independently from one another so if one crashes, the others may continue to work
Mars2501 [29]

Answer:

Tab isolation

Explanation:

Tab isolation is a feature of the browser that works to protect your data from malware. its uses to enhance the reliability of the browser by considering the impact of the crash.

A browser without the tab isolation can be crash fully due to the crashing of one tab. this feature helps to recover the previous opening tab after crashing while on the previous version of the browser if one tab crashes then it automatically crashes all other tabs.

8 0
3 years ago
Joseph wants to take out the color of the background wall from an image what can Joseph do to achieve this​
snow_lady [41]

Answer:

Go to remove a background website

Explanation:

6 0
3 years ago
Read 2 more answers
What is technology? Technology advantages and disadvantages
Alisiya [41]

Explanation:

Technology is a method or skill of utilizing scientific information to reach the goals that include computers, machines and also different techniques.

Advantage of using technology

  • Information can be quickly stored and shared very easily.
  • Technology is used in all companies and businesses to achieve the tasks in a short period with efficiency,
  • Technology has reduces the human errors that have helped to reduce the work stress.

Disadvantages of using technology

  • Corruption and terrorism have increased due to advancements in technology.
  • with the help of technology, digital and data manipulation is done.
  • Too much connected or dependent on technology can cause several psychological problems such as narcissism,depressions, distraction.
  • Using too much of technology can affect physical health such as vision problems, hearing problems, neck strain.

3 0
3 years ago
1:A presentation program which is developed by Microsoft
LekaFEV [45]
Option 3: PowerPoint.
4 0
3 years ago
Read 2 more answers
Other questions:
  • For C++ (please make sure it runs properly)
    14·1 answer
  • List 3 ways that you can use excel and the features it includes and explain why a spreadsheet is the best choice for this task.
    5·1 answer
  • Choosing firm goals for your business
    7·2 answers
  • The term ____ is a technical term for the region of memory that holds data waiting to be transferred from one device to another.
    5·1 answer
  • The primary function of application software is to apply the power of the computer to enable people, workgroups, and the entire
    7·1 answer
  • How do i delete an account for brainly how do i delete everything
    7·2 answers
  • The Internet began when a large company wanted to sell products online.
    11·2 answers
  • What is the plan to make optimum usage of available spaces?
    15·1 answer
  • Define computers software.dicuss the types of computer software​
    5·1 answer
  • A company is completing research and development for software which it is planning to produce in approximately 2 years time. Whi
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!