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]
2 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]2 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
Code a call to the function anotherFunc passing the array myints.
mario62 [17]

Answer:

d)anotherFunc(myints);

Explanation:

When we call a function we just have to pass the names of the arguments to the function.In case of arrays we also just have to pass the name of the array.We don't have to worry about the square brackets.So the function call will be like this.

anotherFunc(myints);

Hence the answer is option d.

4 0
2 years ago
Transaction processing systems (TPSs) provide valuable input to management information systems, decision support systems, and kn
nadezda [96]

A transaction is a simple task carried out as part of corporate operations. Transaction processing systems (TPS) handle business transactions for the corporation, supporting overall enterprise operations.

A TPS creates papers pertaining to a non-inquiry transaction and records the transaction itself, together with all of its results, in the database.

Today, TPS are required for business operations in practically every firm. TPSs feed information into organizational databases; they also serve as the framework for management-oriented information systems. Source data automation frequently involves direct data entering. Electronic data interchange is being utilized by transaction processing systems more and more. These systems offer computer-to-computer communication without the need for repeated data entry by substituting paper documents with formatted transaction data sent over telecommunications networks.

Learn more about information here-

brainly.com/question/15709585

#SPJ4

5 0
1 year ago
What are the two compatibility issues that may arise between computer systems while transferring presentations? different video
Mamont248 [21]

Different video files and operating system versions can cause compatibility issues to arise between computer systems.

Since, file formats and operating systems may not be compatible with each other. For example, earlier versions of Windows may not be able to play certain types of video files due to the codecs used to encode them.

<h3>Importance of compatibility between operating system computer systems</h3>

Compatibility between operating systems is important because it allows different computer systems to interact and share resources. This includes sharing of programs, files, and data.

Compatibility also allows users to access applications and services on different platforms. It also enables efficient use of hardware and software resources, as well as efficient use of resources in a network. Compatibility also ensures that computer systems can communicate with each other and can access the same resources. Without compatibility, it would be difficult for computer systems to interact with each other.

What are two compatibility issues that may arise between computer systems while transferring presentations? (Fill in the blank).

Different video files and _____ can cause compatibility issues to arise between computer systems.

Learn more about Compatibility between operating systems:

brainly.com/question/24760752

#SPJ4

4 0
1 year ago
Write an algorithm and draw a flowchart for switching off a machine after it has made 500 glass bottles. use an appropriate cond
masha68 [24]

The algorithm is as follows:

1. Start

2. bottles = 0

3. While bottles != 500

3.1 Create bottle

3.2 bottle = bottle + 1

4. Switch off machine

5. Stop

Explanation:

This begins the algorithm

1. Start

This initializes bottles to 0

2. bottles = 0

The loop is repeated until 500 bottles is created

3. While bottles != 500

This creates a new bottle

3.1 Create bottle

This increments the number of bottles by 1

3.2 bottle = bottle + 1

This switches of the machine after all bottles are created

4. Switch off machine

End algorithm

5. Stop

THANKS

4 0
2 years ago
What is the difference between the default constructor and the overloaded constructor?
lukranit [14]

Explanation:

A default constructor is a constructor that present in the class by default with no parameters when we write a new constructor with parameters it is called overloaded constructor.There can be different overloaded constructors in the same class.

The main difference between default constructor and overloaded constructor is that the default constructor does't have any parameters while the overloaded constructors have parameters.

4 0
3 years ago
Other questions:
  • Determine the number of bytes necessary to store an uncompressed RGB color image of size 640 × 480 pixels using 8, 10, 12 and 14
    11·1 answer
  • Your organization issues devices to employees. These devices generate one-time passwords every 60 seconds. A server hosted withi
    15·1 answer
  • with the _______ network topology, reliability is the major advantage while high cost is the disadvantage.
    10·2 answers
  • A and B have same output or not? A B x=0 x=0 do do x&lt;3 x=x+1 x=x+1 print x print x while x&lt;3 while
    13·1 answer
  • 9.1.3: Printing vector elements with a for loop. Write a for loop to print all NUM_VALS elements of vector courseGrades, followi
    5·1 answer
  • Can i edit my name on this app?
    7·1 answer
  • The ______ printers are the most popular type of printer in small office/home office and large office environments.
    5·1 answer
  • (TCO B) The symbol shown as a three-sided box that is connected to the step it references by a dashed line is what?
    12·1 answer
  • What is a mod in programming?<br><br> Give more Java questions
    12·1 answer
  • HELPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP!!!
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!