import java.util.Scanner; import java.util.concurrent.TimeUnit; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int uncorrectedErrors = 0; String textSample = "Lorem ipsum dolor sit amet"; String[] partsSample = textSample.split(" "); System.out.println(":: TYPING TEXT ::\n" + textSample); long start = System.currentTimeMillis(); String text = scanner.nextLine(); String parts[] = text.split(" "); int length = text.length() - 1; long end = System.currentTimeMillis(); for (int i = 0; i < partsSample.length; i++) { if (! partsSample[i].equals(parts[i])) { uncorrectedErrors++; } } double time = TimeUnit.MILLISECONDS.toSeconds(end - start); time = time / 60; double grossWPM = (length / 5) / time; System.out.println("Gross WPM: " + grossWPM); double netWPM = grossWPM - (uncorrectedErrors / time); System.out.println("Net WPM: " + netWPM); } }