Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are asked to write a Typing tutor program. This program should teach typing in which a sentence appears on the screen and the user

image text in transcribed
image text in transcribed
You are asked to write a Typing tutor program. This program should teach typing in which a sentence appears on the screen and the user must type it out within a certain amount of time or achieve a certain number of words per minute throughout a beginner level Your program should have 5 sentences consisting of 8-12 word each. Each time a user plays the game a random sentence will be selected from array of strings. After the user types the sentence, the program prints the time it took the user to print the sentence, number of errors (mismatch), number of words typed per sed. Also describe what test cases you used to check the validity of your system (you might have more cases). 1. 2. 3. 4. Entering a correct sentence Entering incorrect sentence. Not completing the sentencel entering longer sentence. Exceeding the time allowed. You should submit your OWN code. i.e. you are not allowed to copy from the internet, any other person or references. You need to do a demo in my office to grade your assignment Hint 1. You can convert a string to an array using the following code String str-testString"; char[] charArray str.toCharArray) 2. You need to record the typing speed. This time should start after the user is allowed to type the sentence till he presses Enter key. It is suggested that you stop the timer immediately before printing out the statistics. The following is a little sample code that shows how you can time events. You need to use the Date class to do it so you may want to check out the documentation on this method at the Java API web site. Do not worry about the Thread.sleepO method in the program -you do not (and should not) be using this function. It only appears here to simulate some kind of work being done. import java.util.* Page 1 of2 Hint 1. You can convert a string to an array using the following code String str "testString char[] charArray str.tocharArrayO: 2. You need to record the typing speed. This time should start after the user is allowed to type the sentence till he presses Enter key. It is suggested that you stop the timer immediately before printing out the statistics. The following is a little sample code that shows how you can time events. You need to use the Date class to do it so you may want to check out the documentation on this method at the Java API web site. Do not worry about the Thread sleep) method in the program - you do not (and should not) be using this function. It only appears here to simulate some kind of work being done import java.util. Page 1 of 2 CpE: 201: Object-Oriented Paradi class Timer public static void main(String] args) try f start the timer Date timeStart new Date(): ll do the actual program work Thread sleep(2000): l stop the timer Date timeEnd new Date(): calculate the total time and print the resut long totalTime timeEnd.getTime0- timeStart.getTime( System.out printin( Total Time:" totalTime) )catch(InterruptedException e) t) You can copy and paste this code in the appropriate place in your code to calculate the typing speed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions