Tuesday, 18 March 2014

Today i m going tell you how you can calculate your typing speed using Java code
Here is the Code :


 import java.util.Scanner;  
   
 public class TypingSpeedCalculator {  
  int no_of_words=0;  
  static int z;  
  double minutes;  
  double start,end;  
    
    
 public int count_Words(){  
 int a=1;  
 String b;  
   
 Scanner s1 = new Scanner(System.in);  
   
 System.out.println("Type some text : ");  
   
 start = System.currentTimeMillis();  
 b = s1.nextLine();  
   
 end = System.currentTimeMillis()-start;  
   
 minutes = end/60000;  
   
 for(int i = 0;i < b.length();i++){  
   
  if(b.charAt(i) == ' '){  
  a = a + 1;  
  }  
 }  
 no_of_words = a;  
   
 return a;  
 }  
   
 public void typing_Speed(){  
  double a = 0;  
    
  a = no_of_words/minutes;  
   
  System.out.println("Your typing Speed is "+a+" WPM");  
 }  
   
 public static void main(String args[]){  
    
  TypingSpeedCalculator ui=new TypingSpeedCalculator();  
   
  System.out.println("\nOutput : \n");  
   
  ui.count_Words();  
   
  ui.typing_Speed();  
 }  
 }  
Output:


  Hope you Liked this. FOLLOW me for more awesome stuff!!! 



Get Your Programming Related Problems SOLVED




2 comments:

  1. Hi,
    I really liked ur post. keep posting.
    Use comments so that we are able to understand even better.
    thanks

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete

Subscribe to RSS Feed Follow me on Twitter!