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
zzz [600]
4 years ago
15

Write a function checkPalindrome that accepts a single argument, a string. The function should return true (Boolean) if the stri

ng is a palindrome, false if it is not. Make sure your function will give the correct answer for words with capital letters.
Computers and Technology
1 answer:
Vsevolod [243]4 years ago
5 0

Answer:

Following are the program in the Java Programming Language.

//define function

public static boolean checkPalindrome(String str){

//set integer variable to 0

int a = 0;

//set integer variable to store the length of the string

int n = str.length() - 1;  

//set the while loop to check the variable a is less than the variable n

while(a<n)

{

//check the string character is not in the variable n

if(str.charAt(a)!= str.charAt(n))

//then, return false

return false;  

//the variable a is incremented by 1

a++;

//the variable n is decremented by 1

n--;

}

//and return true

return true;

}

Explanation:

<u>Following are the description of the following function</u>.

  • Firstly, we define boolean type public function that is 'checkPalindrome' and pass string data type argument 'str' in its parameter.
  • Set two integer data type variables that are 'a' initialize to 0 and 'n' which store the length of the string variable 'str' decremented by 1.
  • Set the While loop that checks the variable 'a' is less than the variable 'n', then we set the If conditional statement to check that the string character is not in the variable n then, return false.
  • Otherwise, it returns true.
You might be interested in
Consider the following code: String word [] = {"algorithm", "boolean", "char", "double"}; for ( int i =0; i &lt; word.length/2;
KiRa [710]

Answer:

{"double", "char", "char", "double"} will be stored in word.

Explanation:

Given the word is an array of four strings,  {"algorithm", "boolean", "char", "double"}. Hence, the length of the word array is 4.

The for-loop will only run for two iterations due to i < word.length/2, with i = 0 (first loop) and i = 1 (second loop).

In the first loop,  

  • word[word.length - 1 - i]  =  word[4 - 1 - 0]  = word[3]  = "double"
  • Hence, the string "double" will be assigned to word[0] and overwrite "algorithm"

In the second loop,

  • word[word.length - 1 - i]  =  word[4 - 1 - 1]  = word[2]  = "char"
  • Hence, the string "char" will be assigned to word[1] and overwrite "boolean"

At last, the word array will hold {"double", "char", "char", "double"}

8 0
4 years ago
Read 2 more answers
The Internet may best be compared to a/an
MA_775_DIABLO [31]
Internet is better than television because we can only movies or shows on television but we can watch anything we want on internet whether its relating to science stuff or some enjoying playful pranks.
8 0
3 years ago
Soa contains a lot of benefits, but _________ is not considered one of them.
AysviL [449]

SOA contains a lot of benefits, but been hard to handle is not considered one of them.

<h3> What is Service Oriented Architecture (SOA)? </h3>

The  Service Oriented Architecture  is known to be where all parts are set up to be services.

They are said  to be Easy to handle new version for subset of users and one can easily get back from mistake in one's design.

The SOA characteristics are:

  • Their Services are self-contained and modular.
  • Their Services support interoperability.
  • Their Services are loosely put together.

Learn more about  Service Oriented Architecture from

brainly.com/question/14835966

8 0
3 years ago
Which statement best justifies the use of a high-speed cache in a CPU?
crimeas [40]

Cache memory is a high-speed memory that stores the instructions and data that have been frequently accessed.  It decreases the time it takes to decode the instructions stored in the instruction pipeline.

A.  It decreases the time it takes to decode instructions stored in the instruction pipeline.

<u>Explanation:</u>

Whenever an instruction is invoked or some data is accessed, the CPU looks for it in the cache memory before accessing the main memory.

If the content is found in the cache memory, it accessed from there and then and hence the access time and decode time is reduced as there were no main memory lockups.

6 0
4 years ago
Moving through a neighborhood trying to locate open wireless access points is called ________.
disa [49]
<span>Moving through a neighborhood trying to locate open wireless access points is called wardriving. 
</span> The action wardriving is performed by a person in a moving vehicle (car, bike..) who is using a laptop or smartphone and wants to catch a Wireless LAN (WiFi) network. For this purpose there is software <span>freely available on the Internet.</span>
7 0
3 years ago
Other questions:
  • Based on the relational model, create the database metadata as part the physical designphase.b)from the metadata, write the sql
    10·1 answer
  • Write a program whose input is two integers and whose output is the two integers swapped. Place the values in an array, where x
    12·1 answer
  • What is a critique of the feature detector model of object recognition?​?
    8·1 answer
  • Assume that an int variable age has been declared and already given a value and assume that a char variable choice has been decl
    9·1 answer
  • What is a good technological design?
    13·1 answer
  • 10
    14·2 answers
  • Pls help
    13·1 answer
  • Rudy accidentally sent a sensitive work report to a personal friend named James instead one of his co-workers, who is also named
    6·1 answer
  • In the 1760s and early 1770s, the British government wanted to raise money by taxing the residents of its colonies in North Amer
    8·1 answer
  • Digital publishing software has increased the use of which of the following?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!