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
scZoUnD [109]
3 years ago
5

java A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "n

ever odd or even" (ignoring spaces). Write a program whose input is a word or phrase, and that outputs whether the input is a palindrome. Ex: If the input is: bob the output is: bob is a palindrome
Computers and Technology
1 answer:
son4ous [18]3 years ago
7 0

Answer:

import java.util.Scanner;

public class num8 {

   public static boolean isPali(String word)

   {

       int i = 0, j = word.length() - 1;

       // compare characters

       while (i < j) {

           // check for match

           if (word.charAt(i) != word.charAt(j))

               return false;

           i++;

           j--;

       }

       return true;

   }

   // Main Method

   public static void main(String[] args)

   {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter a word to test for palidrone");

       String str = in.nextLine();

       if (isPali(str))

           System.out.print(str+" is Palidrone");

       else

           System.out.print(str+ "is not palidrone");

   }

}

Explanation:

  • Create a method that returns a boolean called isPali().
  • Using a while statement check if if (word.charAt(i) != word.charAt(j)) given that i = starts at 0 and j starts at last character in the word. If there is match for each character, return true else return false
  • In the main method use the scanner class to prompt user for a word
  • call the method isPali() and pass the word entered as argument.

You might be interested in
What is the difference between a learner’s license and an operator’s license?
Allushta [10]
A learner's license does not allow the person to drive without someone else who has their operator's (or driver's license) or an adult who is at least 21. Although this varies depending on the state. 
7 0
3 years ago
Por qué el entorno gráfico de Windows es amigable con el hombre ?
elena-14-01-66 [18.8K]

Explanation:

Por que es un sistema diseñado para ayudar a las personas de forma amable

ESPERO Y TE AYUDE ;)

3 0
3 years ago
Discuss the following IT security policies and the level of protection each policy provides in the context of your assigned scen
Oksi-84 [34.3K]

Answer:

IT security policy identifies the methods for all individuals and using the organization's assets and resources. The main objective of Its security is to integrate the system information used by the organization.

Mature security policies need the following procedures.

  • Acceptable use policies
  • Access control policy
  • Change management policy
  • Incident Response
  • Information Security
  • Remote Access
  • Email Policy
  • Business Continuity Plan

Explanation:

Internet use policy

Internet use policy provides the employee with rules about the proper use of company equipment, network, and internet. The system can be tailored to a specific organization. The employee has some responsibility, including e-mail. The employee is responsible that the internet is used efficiently.

External device use policy

An employee using an external device and related software for data access will use secure data management procedures. A strong password must protect all external devices.Employee discloses their passwords to anyone would harm them.

Employee Identity (ID) policy

Employee identity policy indicates that you are an employee in the company.ID cards are issued to the employee. It also provides proper access to the employee to a company.

Computer use policy

Computer use policy is a way to emphasize the employee that a computer is a tool and should be used in manner. Using this policy, the employee monitors the network by three exceptions.

5 0
3 years ago
In last week's meeting we discussed long and short term costs associated with build an buy scenarios using a house as an example
dedylja [7]

Answer:

Custom software designs a software package that is targeted to a particular user community and that meets an organization's specific needs. A lot of these things must be taken into account whenever making a "buy vs. create" decision for a custom software.

Purchasing a wrong program may hinder the process for your business while trying to build one can be expensive and time consuming. The study of these two methods should take into account labor costs, long-term and brief-term costs, and infrastructure costs.

The most popular purpose an organization creates or gets a custom product is that it's special to their organization and if the software is designed effectively it will improve the business' productivity and create its own competitiveness edge.

Moreover, creating a custom software requires a great upfront cost and it also takes a long time to build a proper one.

Labor costs for developing a customized product are often greater than purchasing off-the-shelf solution, as the company has to employ a software developer and build an IT team to create and manage the right software.

There would be maintenance costs in the long run but it wouldn't be as enormous as it was in the building and the process of creation. But, the more significant than cost, is the long-term benefit it brings to the business.

A specific application will improve the workflow of the company, allow the company to retain space with the rate and volume expansion, all of which would help bring financial benefits and distinguish the business from other competitors.

4 0
3 years ago
Assume that name is a variable of type String that has been assigned a value. Write an expression whose value is a String contai
Stella [2.4K]

Corrected (Modified) Question:

i. Assume that name is a variable of type String that has been assigned a value. Write an expression whose value is a String containing the last character of the value of name. So if the value of name were "Smith" the expression's value would be "h".

ii. Given a String variable named sentence that has been initialized, write an expression whose value is the number of characters in the String referred to by sentence.

Explanation of the corrected question

The whole question has been numbered (i) and (ii) just to separate or divide it into clearer sub questions.

Some parts of the question has also been removed since they are repetition of a part of the question.

Answer:

(i) name.charAt(name.length() - 1)

(ii) sentence.length()

Explanation:

No language  has been specified in the question for the code to be written in. However, I have chosen to write it in Java.

(i) In Java, to get a particular character in a string <em>str</em>, the function, charAt(x) is used, where x in the function represents the index of the character to be fetched. This is written as str.charAt(x).

In our case, x is the index of the last character in our string. To get the index of the last character in a string say <em>str</em>, the length of the string itself is used. However, indexing starts at zero. Therefore, to get the index, it will be the 1 subtracted from the length of the string as follows:

str.length() - 1

But note that, to get the length of a string, the method length() is used. For example if,

String str = "omobowale";

str.length() will return 9

Now to the question at hand, our string variable name is <em>name. </em>

Therefore to get its last character, we write:

<em>name.charAt(name.length() - 1)</em>

So if;

name = "Smith";

name.charAt(name.length() - 1) will return "h"

(ii) As explained in (i) above, to get the length (number of characters) of the variable string <em>sentence, </em>we simply write;

<em>sentence.length()</em>

<em>PS: The length of  a string is the number of characters present in the string.</em>

Hope this helps!

3 0
3 years ago
Other questions:
  • What temporarily holds programs and date while the computer is on and allows the computer to access that information randomly?
    12·1 answer
  • A ________ allows a hacker to gain access to your computer and take almost complete control of it without your knowledge. zombie
    15·1 answer
  • The process of recognizing information? needs, using efficient search techniques to locate reliable sources of? information, and
    9·1 answer
  • What are three reasons teens might start drinking alcohol??
    7·2 answers
  • Do you think that people have a “right” to remain anonymous online? Why or why not?
    6·1 answer
  • Ignorance of policy is a legal excuse for an employee. TRUE or FALSE
    11·1 answer
  • For Excel:
    5·1 answer
  • What would your leadership style be?
    14·1 answer
  • HELP!!!!!!!!!! I'M SOO STUCK ON EXCEL OFFICE FUNDAMENTALS!!!!!! I'LL GIVE BRAINLIEST TO THE FIRST RIGHT ANSWER!!!! PLEASE, I'M B
    12·1 answer
  • Government entities may pressure upstream Internet service providers to _____. a. track and monitor the Internet activities of i
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!