Creating a simple Words per minute calclator?

Tomtom9401

New member
Joined
Mar 31, 2015
Messages
2
Programming Experience
Beginner
Hey guys,

New to the forums and fairly new to programming in general. I have recently obtained a strong interest in all programming; all starting from wanting to develop my own website with HTML, CSS, and JS. I have bought a few books to potentially help me with my learning, but I have decided to try and dive into the fire so to speak. It was a bit overwhelming with all the various types of programming languages, but I have decided to jump right into C# due to its wide range of uses. To get to the point, I am still in the early stages of experimenting with console applications. At the current moment I have worked my way to a basic program that displays a sentence that must be copied and will tell you if it is correct or not. I am now trying to implement a timer that will start from the moment you start typing, end when you hit enter, and tell you how long it took in WPM ( Words per minute). A very basic word per minute calculator. I am having trouble finding information on implementing such a timer, or perhaps have not yet realized a way to apply what I have learned. I am currently using Monodevelop (Xamarin Studio) for programming. Any helpful links or advice would be much appreciated. Thanks a bunch.
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
4,064
Location
Sydney, Australia
Programming Experience
10+
You may be confused because the multiple Timer classes in the .NET Framework actually behave like alarm clocks. If you want to measure an arbitrary amount of elapsed time then that's like a stopwatch, so you would use the Stopwatch class, which is a member of the System.Diagnostics namespace. The first thing to do is check that that class is supported in Mono. I'm guessing it is. You would handle the KeyDown (or maybe PreviewKeyDown for `Enter`) event and call Start and Stop on the Stopwatch at the appropriate times. It's then simple maths to get the typing speed.
 

Tomtom9401

New member
Joined
Mar 31, 2015
Messages
2
Programming Experience
Beginner
You may be confused because the multiple Timer classes in the .NET Framework actually behave like alarm clocks. If you want to measure an arbitrary amount of elapsed time then that's like a stopwatch, so you would use the Stopwatch class, which is a member of the System.Diagnostics namespace. The first thing to do is check that that class is supported in Mono. I'm guessing it is. You would handle the KeyDown (or maybe PreviewKeyDown for `Enter`) event and call Start and Stop on the Stopwatch at the appropriate times. It's then simple maths to get the typing speed.

Okay awesome that makes a lot more sense than what I was reading haha thanks a bunch
 
Top Bottom