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
Holly created a professional development plan to explore how she could advance from her entry-level position to the next step in
Sunny_sXe [5.5K]
A.) Ask a colleague for advice work life balance
3 0
3 years ago
Read 2 more answers
Which option will enable Mina to apply several formats to the spreadsheet cells at the same time?
madam [21]
Applying a cell style will enable Mina to apply several formats to the spreadsheet cells at the same time.  <span>To apply several formats in one step, and to make sure that cells have consistent formatting, you can use a cell style. A cell style is a defined set of formatting characteristics, such as fonts and font sizes, number formats, cell borders, and cell shading. </span>
4 0
3 years ago
Write a SELECT statement to create a lesson schedule for Feb 1, 2020 with the lesson date/time, student's first and last names,
Fed [463]

SELECT statement are used to retrieve data from a database table

The SELECT statement that creates the lesson schedule is:

<em>SELECT LessonDateTime, HorseID, FirstName, LastName FROM LessonSchedule JOIN Student ON LessonSchedule.StudentID = Student.ID ORDER BY LessonDateTime ASC, HorseID</em>

<h3>How to determine the SELECT statement</h3>

To write the select statement, we start by writing the following query that retrieves Lesson date/time, horse ID, first name, and last name from the lesson schedule table.

So, we have:

SELECT LessonDateTime, HorseID, FirstName, LastName FROM LessonSchedule

Next, the query would confirm the presence of a student ID in the lesson schedule table and the student table using the JOIN statement

JOIN Student ON LessonSchedule.StudentID = Student.ID

From the question, we understand that:

The result should be sorted in ascending order by lesson date/time.

This is represented as:

ORDER BY LessonDateTime ASC, HorseID

Hence, the complete query is:

SELECT LessonDateTime, HorseID, FirstName, LastName FROM LessonSchedule JOIN Student ON LessonSchedule.StudentID = Student.ID ORDER BY LessonDateTime ASC, HorseID

Read more about database at:

brainly.com/question/24223730

4 0
3 years ago
Which group is not found on the sparkline tools design tab? a. format b. type c. show d. style
VashaNatasha [74]
Format sparkline tools design tab
4 0
3 years ago
Joe is a computer service technician. People in his neighborhood usually depend on his suggestions for purchasing any computer a
ser-zykov [4K]

Answer:

C

Explanation:

Because he's knowledge ,everyone asking he's opinion if i am not wrong.

I hope i did help you on this questions

8 0
4 years ago
Read 2 more answers
Other questions:
  • what happens when you double-click on a file with an extension that represents an executable program?
    5·1 answer
  • ________ software helps run the computer and coordinates instructions between other software and the hardware devices.
    7·1 answer
  • An administrator has noticed that GPO containing new update settings has not yet applied to one of the computers on the network.
    5·1 answer
  • What is the name of the device that senses the current flowing, tripping the circuit, and cutting off the electricity?
    13·1 answer
  • In 5-10 sentences, describe how computer networks work.
    6·1 answer
  • Email, instant messaging and most web traffic go across the internet in the clear; that is, anyone who can capture that informat
    15·2 answers
  • The D:\ drive in your computer has been formatted with NTFS. The Mary user account has been assigned the following permissions:
    10·1 answer
  • Film’s importance in today’s economy?
    12·1 answer
  • 6. What is Microsoft office word 2010 and who developed it?​
    15·1 answer
  • Radio spectrum is the part of the complete range of electromagnetic waves that is used for radio communication from
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!