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
maria [59]
3 years ago
14

Write a program that uses a scanner to report some statistics about words in an input sentence ( see Section 7.8). The outputs s

hould be the number of words in the sentence, the average word length, and the length of the sentence.
Computers and Technology
1 answer:
Alla [95]3 years ago
8 0

import java.util.Scanner;

public class JavaApplication77 {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

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

       String sentence = scan.nextLine();

       String [] arr = new String[sentence.length()];

       arr = sentence.split(" ");

       System.out.println("There are "+arr.length+" words in the sentence.");

       int count = 0;

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

           count += arr[i].length();

       }

       System.out.println("The average length of a word in your sentence is "+(count/arr.length)+" characters");

       count = 0;

       System.out.println("Your sentence is "+sentence.length()+" characters long.");

       

   }

   

}

For the length of a sentence, I included spaces as characters but I did not do this for the length of a word. I hope this helps!

You might be interested in
In the picture below
zhuklara [117]

Answer:

The answer is "It is a public method in the Car class".

Explanation:

In this question, the fourth choice is correct because the accessor method will be public, and the incorrect choice can be defined as follows:

  • The first and second choice was wrong because the class name is "Car".
  • In the third choice, it is wrong because the method will not be private.
  • In the fifth choice, it is wrong because the object name "mustang".
7 0
3 years ago
Which of the following is true of lossy and lossless compression algorithms?
zysi [14]
The answer would be D.
I think I’m not totally sure:)
8 0
3 years ago
Software that translates the sound of human voice into text is called:________.
S_A_V [24]

Answer:

C) speech recognition software.

Explanation:

Software that translates the sound of human voice into text is called a speech recognition software.

In Computer science, a speech recognition software is a voice technology application or program which enables the conversion of human voice such as spoken language to computer commands such as text through the use of speech recognition algorithms.

Some examples of speech recognition software are HTK, Kaldi, Voice navigator, Julius etc.

6 0
3 years ago
What is an effective technique for searching the web?
Arte-miy333 [17]
Google.com, Bing, or Dark Web engines.
7 0
4 years ago
What percentage of teens plays video games?<br><br> A.97%<br> B.100%<br> C.74%<br> D.50%
inna [77]

Answer:

This would all depend on what kind of video games you are talking about, most people would say that playing on you phone is like playing a game on a console or a PC.  

most kids do play on these three things, so I'm going to go with answer choice C.

Explanation:

Reason why is because just like there are many who play, there are many who don't. I being one who prefers to read would like to make it known that not all teens do play video games, and that there are plenty of those who would rather do something productive.

7 0
4 years ago
Read 2 more answers
Other questions:
  • What is the most widely used operating system for mobile devices?
    7·1 answer
  • What are operational databases
    12·1 answer
  • In the context of web and network privacy, an acceptable use policy is _____.
    15·1 answer
  • Give two advantages of representing integers in pure binary.
    5·1 answer
  • How do you suppose a request travels from one computer to another? How does the request know where to go?
    8·1 answer
  • You are the IT Administrator for the CorpNet.local domain. You are in the process of implementing a group strategy for your netw
    13·1 answer
  • What is the minimum number of bits needed to store the decimal value 200?
    12·1 answer
  • An algorithm whose worst-case time complexity is bounded above by a polynomial function of its size is called a(n)
    13·1 answer
  • Help me pleaseeee!!!!!
    6·2 answers
  • Enter a formula in cell C13 to look up the registration fee for the first vehicle. Use the vehicle type in cell C4 as the Lookup
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!