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
The Domain Name Service is what translates human-readable domain names into IP addresses that computers and routers understandA.
Mars2501 [29]

Answer:

True

Explanation:

A Domain Name Service comprises of computer servers that carries a database of public IP addresses and their related human-readable domain names/hostnames, it receives query as hostnames and helps to translates those human-readable domain names/hostnames into IP addresses that computers and routers understand.

5 0
3 years ago
________ is a mobile broadband technology that relies on microwave transmissions to blanket large metropolitan areas from microw
FinnZ [79.3K]

Answer:

WiMax

Explanation:

Wimax is a family standards of a communication of bandwidth, this is a standard IEEE 802.16, was created to provide data velocity like 30 or 40 megabits per seconds, but in 2011 was updated, and now can provide 1 gigabit per second, the name WiMAX is for a forum created in 2001 to promote the standard.

4 0
3 years ago
There was a thunderstorm in your area and the power went out.
Anna71 [15]

Answer:

A) The law requires that when I get to an intersection, I have to allow a right-of-way to the vehicles approaching from the right.

B) if there is an officer directing traffic, then I have to follow the directives of the officer.

Cheers!

8 0
3 years ago
Spoderman memes<br> im scared-
DENIUS [597]

Don't be afraid of spooderman. He's hot.

4 0
3 years ago
Read 2 more answers
Consider the following configuration. ​ Computer ""A"" IP address: 172.16.100.100 Subnet mask: 255.255.0.0 ​ Computer ""B"" IP a
denpristay [2]

Answer:

There is nothing to change.

Explanation:

In the following configuration given in the problem, the necessary IP addresses and the subnet masks have been included in the configuration. The computers can be used to send and/or receive information to/from each other. The computers have been properly set-up and there is nothing to be done to the settings or configurations.

4 0
3 years ago
Other questions:
  • What is one word for inventiveness uncertainty and futuristic
    5·1 answer
  • Using Module operator, write a java program to print odd number between 0 and 1000​
    5·1 answer
  • A network engineer arrives at work and discovers that many users are having problems when attempting to connect to the company n
    9·2 answers
  • Which one of the following rules for selecting a password is the best?
    5·2 answers
  • _______ is the protocol suite for the current Internet.
    9·1 answer
  • Sonic the Hedgehog (1991)
    14·1 answer
  • Why did Simon bring Michael home?​
    9·2 answers
  • Miriam Is a network administrator. A few employees want to access sensitive Information stored on a backup device. She wants to
    13·1 answer
  • Aranjează următoarele cuvinte din documentul word Proiect, într-o scrisoare în care soliciți directorului școlii sprijin în priv
    8·1 answer
  • The _____ _____ form of database attack injects code into user login information with one or more statements that perform action
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!