This program allows you to practice typing using pangrams and to practice copy-paste and modifying a program.
- Click on this link, follow directions, and then RETURN here. JJS SETUP LINK.
- Click on this text so that the next step works.
- Ctrl-A: to select all (it will scroll to the bottom).
- Program->Run-Selected: to run the selected code.
- Once you have played the game, copy it (Ctrl-A then Ctrl-C) and place it in a
new editor window. Read through and modify the code to make your own game.
- Copy this program to a new editor window, and modify it so that it asks for some other sentence.
*/
String attempt;
String challengeString;
challengeString = "The quick brown fox jumps over a lazy dog";
System.out.println("Test your typing, enter the following sentence: ");
System.out.println("");
System.out.println(challengeString);
System.out.println("");
JJS.startTimer();
attempt = JJS.inputString();
System.out.print("Your time in milliseconds: ");
System.out.println(JJS.millisSinceStartTimer());
if (attempt.equals(challengeString)) {
System.out.println("Congratulations, you got it!");
} else {
System.out.println(attempt);
System.out.println("Sorry, your typing is not exactly correct");
System.out.println("Compile and run to try again.");
}
|