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
brilliants [131]
3 years ago
12

Write a void method called palindromeCheck that takes NO argument. The method should have functionality to check whether or not

the word is a palindrome and print to the screen all of the palindromes, one per line. Also, the last line of the output should have the message: "There are x palindromes out of y words provided by user" (where x is the number of palindrome words detected, and y is the total number of words entered by user). Hint: for this lab exercise you will need the following methods on String objects: length() gives the length of a string (that is, the number of characters it contains) and charAt(i) - gives the character at position i.
Computers and Technology
1 answer:
finlep [7]3 years ago
8 0

Answer:

Explanation:

import java.util.Scanner;

public class PalindromeCheck

{

public static void palindromeCheck()

{

String someWord=" ";

int count=0;

int total=0;

System.out.println("Ënter some words entered by whitespace");

Scanner keyboard =new Scanner(System.in);

String[] words=keyboard.nextLine().split(" ");

for(int i=0;i<words.length;i++)

{

boolean flag=true;

int l=words[i].length();

for(int j=0;j<=l/2;j++)

{

if(words[i].charAt(j)!=words[i].charAt(l-j-1))

{

flag=false;

break;

}

}

if(flag)

count++;

}

System.out.println("There are "+count+" palindromes out of "+words.length+" words");

keyboard.close();

}

public static void main(String[] args)

{

palindromeCheck();

}

}

Output

Ënter some words entered by whitespace

This is a malayalam.

There are 3 palindromes out of 4 words

You might be interested in
___ is an example of a function prototype.
Alborosie

Answer:

A

Explanation:

B is a print statement.

C is a function invocation

D is a function declaration

A prototype is actually quite close to a declaration. The semi-colon at the end shows that no implementation will follow. Adding parameter names is allowed but would only be helpful for better understanding.

4 0
3 years ago
Please Help ASAP. Marking Brainliest For Correct Answer.
mezya [45]

Answer: It is not working because it is missing the code needed to turn right.

Sentence :The robot would move forward two squares and would stay stuck there because it can not move forward nor turn left. You would need to add code for the robot to be able to turn right so that the robot can reach the goal

6 0
3 years ago
As part of their extensive kitchen remodel, the Lees told their electrical contractors that they would need plenty of outlets fo
Vanyuwa [196]

The kind of wire and circuit breaker are:  grounding wire such as fairly large bare copper wire.

<h3>What is the best wire for the above?</h3>

A 20A, 120V small-appliance branch circuit is known to be  used in the case above.

Note that Electric range circuits needs about 50-amp, 240-volt made for circuit that is said to supplies the power to the range or oven via  a 6-3 electrical wire.

Learn more about circuit breaker from

brainly.com/question/8976395

#SPJ1

5 0
2 years ago
Anyone help pls ? Complete the code below to add css to make the background of the web page orange.
pochemuha

Answer:

In HTML file

<body style="background-color:orange;">

Or

In CSS file

body {

background-color: orange;

}

7 0
3 years ago
(EASY)
AnnyKZ [126]
If you go to a college website you will see the it has .edu in the URL extensions.
3 0
3 years ago
Read 2 more answers
Other questions:
  • After calling the customer service line of Delta airlines, Francis received an email asking her to fill out customer satisfactio
    9·1 answer
  • What Is the output of the following: =OR (5 &lt;7, 16*Rand ()&gt;23,FALSE)
    5·1 answer
  • What is ment by creative middle way solution
    6·1 answer
  • You have just driven to the Hewlett-Packard site in Corvallis to field-interview a programmer. You sit down in a conference room
    6·1 answer
  • (10 points) A stopwatch has three states named Zero, Running, and Stopped. There are two buttons, named B1 and B2. For each butt
    13·1 answer
  • Liquid-liquid extraction is best suited to separate a mixture of compounds when:
    9·1 answer
  • A security administrator plans to conduct a vulnerability scan on the network to determine if system applications are up to date
    15·1 answer
  • What is the output of the following program? If there is any problem, how can
    13·1 answer
  • Which option should you choose to change the background of your current slide?
    10·2 answers
  • A character that <br>is raised and smaller above the baseline is called​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!