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]
3 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]3 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
Write a basic notation for
Licemer1 [7]

Answer:

a = (b + c)/(2 * c)

z = x/(y + c)

c = (9 * c + 32)/5

Explanation:

Required

The expression in basic

To do this, we use () to group items, / as divide and * to combine factors

So, we have:

(a)\ a = \frac{(b + d)}{2c}

In basic, it is:

a = (b + c)/(2 * c)

(b)\ z = \frac{x}{y + c}

In basic, it is:

z = x/(y + c)

(c)\ c = \frac{9c + 32}{5}

c = (9 * c + 32)/5

4 0
3 years ago
Marty uses a customized database to sort parts and track inventory. The customized database is an example of _____.
MakcuM [25]

cataloging, that is a term for it.

3 0
3 years ago
This is in government
Anon25 [30]
I would have thought that it was C.

5 0
3 years ago
Caracteristicas de los valores numericos en excel
Vilka [71]
Todos los libros de Excel están formados por hojas, cada una de las hojas contiene más de 17 mil millones de celdas y en cada una de esas celdas podremos almacenar nuestros datos. Por esta razón es importante conocer los tipos de datos que podemos ingresar en cada una de las  celdas de Excel


hope this help
6 0
3 years ago
A host automatically configured with an address from which of the following ranges indicates an inability to contact a DHCP serv
Lynna [10]

Answer:

D. 169.254.x.x with a mask of 255.255.0.0

Explanation:

The ranges which indicate the inability to contact a DHCP server is option D form the options provided .A DHCP(Dynamic Host Configuration Protocol) server is a server that automatically assigns the default gateways,IP addresses and other netwok parameters to the clients.

3 0
3 years ago
Other questions:
  • Num = int(input("Enter a number: "))
    5·2 answers
  • Which protocols are TCP/IP application layer protocols? (choose all that apply)
    5·2 answers
  • What is the simple way to permanently get rid of an unwanted file
    14·1 answer
  • I play Among us :) hbu
    7·2 answers
  • What were the first microblogs known as?
    13·2 answers
  • You have a small company and want to keep your cost low, but it is important your employees share data. which network would prov
    13·1 answer
  • Which kind of image is indispensable and needs added text to go with ?
    12·1 answer
  • What do you think entertainment or gaming platforms will look like in the future?
    9·1 answer
  • An engine that generates hot, expanding gases by burning fuel inside the machine.
    9·1 answer
  • Since data-flow diagrams concentrate on the movement of data between processes, these diagrams are often referred to as: A. flow
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!