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]
2 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]2 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
Cui documents must be reviewed to which procedures before destruction?
Aliun [14]

Answer:

Documents containing CUI must be destroyed by shredding..

Explanation:

Hope it helps you..

Your welcome in advance..

(ㆁωㆁ)

8 0
3 years ago
Andy wants to install a new Internet connection. He wants to take the fastest he can get. What are the maximum speeds for the fo
aksik [14]

Answer:

1. so if i wanted to build a linux server for web services(apache) with 1cpu and 2 gb of memory.-operating at 75% of memory capacity2. a windows server with 2 cpu/ 4gb memory- operating at 85% of memory capacity3. a storage server with 1 cpu/ 2gb memory- operating at 85% of memory capacityhow much memory do i have to add for each server. so that the utilization rate for both cpu and memory is at a baseline of 60%."the details for the cpu like its processor or the memory's speed isnt to be concerned" yeah i kept asking my teacher if he's even sure about the but the whole class seems to be confused and the project is due in 3 days..this is a virtualization project where i have to virtualize a typical server into an exsi hypervisor.

5 0
3 years ago
What is the purpose of the Format Painter?
Oduvanchick [21]

Answer:

changes the formatting to be exact from what is copied to what should be

Explanation:

It happens to be the feature of the MS word that is applied to a style from one section of the document to another section. We first highlight the text with the thought of style like size, font, etc., and then click the format painter. The text that is highlighted next, gets transformed into the thought of style. And hence, the above option is correct.

5 0
3 years ago
A(n) __________ is a popular way to describe relationships? (i.e., one-to-one,? one-to-many) in a relational database.
Leto [7]
A link is a popular way to describe relationships in a relational database.
There are three types of relationships (links) between tables:
1. One-to-one <span>relationship , that allows only one record on each side of the relationship.
2. </span>One-to-many <span>relationship, that allows a single record in one table to be related to multiple records in another table.
3. </span>Many-to-many<span> relationship, in which many records in a table can link to many records in another table. F</span>
6 0
3 years ago
This question refers to a standard deck of playing cards. If you are unfamiliar with playing cards, there is an explanation in P
Norma-Jean [14]

Answer:

Explanation:

Number of ways to select 10 girls in 35C₁₀

Number of ways to select 10 boys in 35C₁₀

Total Number of ways to select is 35C₁₀ x 35C₁₀

4 0
3 years ago
Read 2 more answers
Other questions:
  • You’ve received a tarball called data79.tar from a colleague, but you want to check the names of the files it contains before ex
    15·1 answer
  • _____ software can help a company manage security, enforce corporate strategies, and control downloads and content streaming fro
    11·1 answer
  • Add is a function that accepts two int parameters and returns their sum.
    8·1 answer
  • What is the purpose of citations?
    13·1 answer
  • Which routing protocol does an exterior router use to collect data to build its routing tables?
    8·1 answer
  • Items that are cut or copied are placed on the Clipboard.
    6·2 answers
  • For safety, the lights on your vehicle must be in good working condition. Which statement about
    8·2 answers
  • Match the characteristics to the mobile operating system that it describes.
    6·1 answer
  • Phishing is ____________. When hackers overwhelm a website with too many requests. A network of private computers infected with
    7·1 answer
  • Write a FOR loop that displays the following numbers exactly like this (you must use a loop):
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!