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
Ainat [17]
3 years ago
6

Write code which takes a sentence as an input from the user and then prints the length of the first word in that sentence.

Computers and Technology
1 answer:
Afina-wow [57]3 years ago
7 0

import java.util.Scanner;

public class U2_L3_Activity_Four {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter a sentence.");

       String sent = scan.nextLine();

       int count = 0;

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

           char c = sent.charAt(i);

           if (c != ' '){

               count++;

       }

           else{

               break;

           }

       

   }

       System.out.println("The first word is " + count +" letters long");

   

   }

}

We check to see when the first space occurs in our string and we add one to our count variable for every letter before that. I hope this helps!

You might be interested in
The isometric projection camera technique provides an illusion of perspective by using things like parallax scrolling to create
Oksi-84 [34.3K]

Answer:

False.  

Explanation:

In this question some information is missing the question does not mention which type of question is this. This question is a true/false type question.

isometric projection camera is an engineer or the technical drawing in which we represented the 3D(three dimensional) objects in the 2D(Two dimensional) objects. This camera representing the object in a visual manner. isometric projection is also known as Isometric drawing, In the isometric projection camera, all the angles are equal. It does not provide an illusion perspective by using parallax scrolling to create the illusion of 3D in a 2D game.

3 0
3 years ago
What is output? <br> Print (12 % 5)<br><br> Answer <br> 0<br> 5<br> 2<br> 1
pickupchik [31]

Answer:

5

Explanation:

7 0
3 years ago
Read 2 more answers
You are using a device that reads the physical addresses contained in incoming data that travels along network cables. Based on
GuDViN [60]

You are using a device that reads the physical addresses contained in incoming data that travels along network cables. Based on the physical address that it reads, the device then forwards the data out one of its ports to reach the destination device. The type of device you are using is router.

<h3>What is Router?</h3>

A router is an hardware device that is used in transferring information or data from a system to another.

The data can also be transfered from one computer networks to another.

Router makes it easier for more than one device to be connected easily without difficult Internet access.

Therefore, The type of device you are using that reads incoming data that travels along network cables is router.

Learn more on router below

brainly.com/question/24812743

#SPJ1

3 0
2 years ago
When she manages a software development project, Candace uses a program called __________, because it supports a number of progr
alexandr402 [8]

Answer:

PLS programming language supporting.

Explanation:

7 0
3 years ago
What are the steps of active listening?
SashulF [63]
1 prepare mentally
2 pay attention
3 allow the speaker to talk without interruption until he is done
4 provide feedback
5 repeat the feedback until you and the communicator are satisfied that the message was conveyed well
7 0
3 years ago
Other questions:
  • The collodion process was significantly more expensive than the cost of a daguerreotype
    10·1 answer
  • * Declare a variablecalled "car" of type "Car", and initialise its value to a new instance of the "Car"class.
    9·1 answer
  • Yet another variation: A better packet switched network employs the concept of acknowledgment. When the end user’s device receiv
    11·1 answer
  • Bitnet, one of the predecessors of the internet was launched in 1981. what does bitnet stand for?
    12·1 answer
  • What is binary number
    11·1 answer
  • When the atmosphere has too much carbon dioxide in it, the oceans absorb some of it to achieve a new balance. This is an example
    9·2 answers
  • The word __________ refers to the numbers, words, or more generally, any collection of symbols that is manipulated by a program.
    7·1 answer
  • Nonprogrammed decision
    7·1 answer
  • Dominic's teacher asked him to create a chart or graph to compare the different grade levels in the school's FBLA club. Which ch
    5·2 answers
  • Read the attached paper titled A Survey of Coarse-Grained Reconfigurable Architecture and comment on it. Make sure to specifical
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!