Tuesday, 15 May 2012

java.util.scanner - Java - Adding basic statistics to my program -


I have created a small scanner program that removes the tone of the input phrases. This is doing great work, except now I have to add a line to display some simple statistics, but I do not know where it starts.

What I currently do is:

  public static zero main (string [] args) {new digvolor (); } Public Dismovoler () {System.out.println ("Welcome to UM! \ N"); Scanner = new scanner (System.in); System.out.println ("Enter your phrase:"); String input = in.nextLine (); // Input the in.close (); // Close the scanner System.out.println ("\ nYour malformed phrase:" + input.replaceAll ("[aeoiu]", ""));  

Output:

Welcome to the disemvoweling utility!

Enter your phrase: Thank you for your help!

Your aforementioned phrase: Thank you for HRP!

I'm trying to add to the output:

Reduced Xx% reduction rate from X to X characters

Someone should occasionally answer such questions :) Do not forget to say hello to my teacher :)

  string less = input.replaceAll ("[aeoiu]", ""); System.out.println ("\ nYour Exceptioned Phrase:" + less); System.out.println ("+ input.length () +" to "+ less" length () + "lack of characters" + ((double) decreased. Length () / input.length () * 100) + "%");  

No comments:

Post a Comment