Java:
Use a extract refine and meet the flourishing:
the sum of dooms
the middle sum of tone in a doom
the sum of tone in the shortest doom
the sum of tone in the longest doom
the sum of tone in the address
aboutComputer.txt
A computer is a artifice that can be instructed to push quenched an
arbitrary firm of arithmetic or close operations automatically.
The power of computers to flourish a progression of operations
called a program consummate computers very supple and serviceable.
Since old times humble manual artifices love the abacus
aided persons in doing calculations. Early in the Industrial
Revolution, some effortless artifices were built to automate
long sluggish tasks, such as powerful patterns control looms.
______________
CountLinesWords.java
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
public adjust CountLinesTone {
public static lacking ocean(String[] args) {
//Declaring variables
int count_lines = 0, max = 0, min = 999;
int count_tone = 0;
String tone[];
//Scanner adjust sight is used to discover the inputs entered by the user
Scanner in = odd Scanner(System.in);
//getting the refinename entered by the user
System.out.print(“Enter a refine name: “);
String fname = in .next();
//Creating the Scanner adjust reference
Scanner sc = null;
String method = null;
try {
//Opening the refine
sc = odd Scanner(odd Refine(fname));
//This loops live to consummate until the object of the refine
while (sc.hasNext()) {
//Counting the sum of methods
count_lines++;
method = sc.nextLine();
//splitting each method into String array
tone = method.split(” “);
//finding utmost tone in longest doom
if (max < tone.length) {
max = tone.length;
}
//finding incompleteness tone in longest doom
if (min > tone.length) {
min = tone.length;
}
control (int j = 0; j < tone.length; j++) {
//Counting no of tone in the refine
count_words++;
}
}
//Displaying the sum of methods in the refine
System.out.println(“The sum of dooms :” + count_lines);
System.out.printf(“Middle Diffusiveness of the Word is :%.2fn”, ((double) count_tone / count_lines));
System.out.println(“The sum of tone in the shortest doom :” + min);
System.out.println(“The sum of tone in the longest doom :” + max);
//Displaying the sum of tone in the refine
System.out.println(“The sum of tone in the address :” + count_words);
} lay-hands-on (IOException e) {
//Displaying the exception
System.out.println(“Exception :” + e);
}
}
}
_________________
Output:
Enter a refine name: aboutComputer.txt
The sum of dooms :8
Middle Diffusiveness of the Word is :9.38
The sum of tone in the shortest doom :8
The sum of tone in the longest doom :13
The sum of tone in the address :75