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
crimeas [40]
2 years ago
7

8. Given the array String[] words, which already contains 1 or more values, write a block of code which counts and returns the n

umber of words which start with the letter k
Computers and Technology
1 answer:
Vikentia [17]2 years ago
7 0

Answer:

Following are the code to this question:

public class Main//defining a class

{

public static void main(String[] arg)//defining main method

{

  String[] words={"Key","day", "Know", "kind"};//defining array of String words

  int x=0;//defining integer variable for count value

  for(int i=0;i<words.length;i++)//defining for loop for count value

  {

 if(words[i].startsWith("k")||words[i].startsWith("K"))//use if block to check word start from k

  x=x+1;//increment the value of x

  }

System.out.print("The number of letters which starts from k is: "+ x);//print value with message

}

}

Output:

The number of letters which starts from k is: 3

Explanation:

In this code, inside the main method an array of String "words" is defined that hold a value, and in the next step an integer variable "x" is defined, which is used to count the letters, which starts from k.

For this, a for loop is used that counts the value and in this an, if block is defined that uses the "startsWith" method to check the value and increment the value of x and at the last, it prints its value.

You might be interested in
In cell I5, enter a formula to calculate the total admission fees collected for the 2018
V125BC [204]
The formula is to calculate the total admission fees collected is = F5*B14

1. Click on cell I5
2. Type equal sign =
3. Type F5 or click on F5 cell
3. Type multiplication sign *
4. Type B14 or click on B14 cell
4 0
3 years ago
Read 2 more answers
Can someone please tell me what I’m doing wrong ? Please and it’s due on Thursday!!
liberstina [14]

Answer:

Sure. In Unit test 5, it's looking for 1 instead of 0. You are returning 0 instead of 1.

0 requires 1 digit to express it and should therefore return 1.

In line 6, change the 0 to a 1.

8 0
2 years ago
Its Simple To delete Your Own Online Poste Or Photos But
tensa zangetsu [6.8K]

its not simple nothing never is deleted from online posts or photos

4 0
3 years ago
Read 2 more answers
Write an algorithm for switching off the electric water heater automatically when the temperature rises to 70 o Celsius.
noname [10]

Answer:

The algorithm for switching off the electric water heater automatically when the temperature rises to 70 o Celsius is given below.

Explanation:

Let use python code for this question.

we will use if statement to check the condition if the temperature is greater than 70.

When the temperature is 70, then the algorithm will send signal to hardware to turn yourself off.

if(temperature==70):

      print("send_turn_off_signal")

3 0
2 years ago
Proxy servers and ACLs on network devices are examples of non-security devices with security features, while firewalls and IDS/I
RideAnS [48]

Answer:

True.

Explanation:

A proxy server, for example, can hide the true origin of a request, thus, keeping your IP address private, and non-visible to the internet. However, this won't necessarily keep malicious attackers from reaching your network. A proxy simply acts as an intermediary between you, and the server you are trying to reach.

Firewalls or an Intrusion Detection Systems (IDS) are pieces of software specifically designed to keep attackers out of your system, they can analyze the web traffic and detect malware, or they can prevent the delivery of some packages, based on its content if the IDS consider it's malicious.

6 0
3 years ago
Other questions:
  • Suppose you have two arrays of ints, arr1 and arr2, each containing ints that are sorted in ascending order. Write a static meth
    7·1 answer
  • A computer processes data only using 1s and 0s
    10·2 answers
  • What is the other name of the horizontal column graph?
    6·2 answers
  • How do you enter the command prompt on Chromebook
    10·1 answer
  • What are three ways you cite evedince
    5·2 answers
  • If the Account Number field in a record always should display the three characters in the account number in uppercase, then the
    14·1 answer
  • Communication among office computers is based on a protocol that uses CRC-32 for error detection. A series of 100 identical test
    15·1 answer
  • 2) Search the Web for two or more sites that discuss the ongoing responsibilities of the security manager. What other components
    15·1 answer
  • What function returns a line and moves the file pointer to the next line?
    9·1 answer
  • graham drove 39 2/3 miles in 1 1/3 hours. What is the unit rate for miles per hour? Use a pencile and paper. Describe a situatio
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!