Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-28-2007, 10:56 PM
Member
 
Join Date: Nov 2007
Location: Hershey, PA
Posts: 13
padutch2 is on a distinguished road
Send a message via AIM to padutch2
What jdk do I download?
I use Netbeans at school and just downloaded the most newest version of it but I need to download a jdk or something and i dont know which one to downoad.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-28-2007, 11:03 PM
Member
 
Join Date: Nov 2007
Location: Hershey, PA
Posts: 13
padutch2 is on a distinguished road
Send a message via AIM to padutch2
Also I got to design this one program but im stuck, can anyone point me in the right direction?

Design and implement an application that reads a string from the user, then determines and prints how many of each lowercase vowel (a,e,i,o,u) appear in the string. Have a seperate counter for each vowel. Also count and print the number of constants,spaces, and punctuation marks.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 11-29-2007, 02:00 AM
Senior Member
 
Join Date: Nov 2007
Location: Newport, WA
Posts: 141
staykovmarin is on a distinguished road
If you want all the newest features, then you should definitely get jdk6. I use 5, because there is nothing in 6 that i need.

You can use a Regex to do that:
Code:
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexFinder { public static void main(String args[]) { try { new RegexFinder(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } RegexFinder() throws IOException { // this is the Regex pattern: // any vowels: aeiou // spaces: \\s // punctioation : ?.,! (note: the ! must be escaped \\! because in Regex // it means NOT. we are just looking for the ! char Pattern pattern = Pattern.compile("[aeiou\\s?.,\\!]"); // edit: forgot that you needed it to read from command line while (true) { System.out.print("Enter the string to search: "); BufferedReader in = new BufferedReader(new InputStreamReader( System.in)); Matcher m = pattern.matcher(in.readLine()); // all the counter variables int a = 0, e = 0, i = 0, o = 0, u = 0, space = 0, punks = 0; while (m.find()) { // this switch looks trough each character matched by the regex, // and // evaluates it switch ((int) m.group().charAt(0)) { case 'a': a++; break; case 'e': e++; break; case 'i': i++; break; case 'o': o++; break; case 'u': u++; break; case ' ': space++; break; default: // if it is not any of the above, but still found by the // regex, // it must be a punctioation mark punks++; } } System.out.println("# of a=" + a + "\n# of e=" + e + "\n# of i=" + i + "\n# of o=" + o + "\n# of u=" + u + "\n# of spaces=" + space + "\n# of punctuation marks=" + punks); } } }

Last edited by staykovmarin : 11-29-2007 at 02:33 AM.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 11-29-2007, 05:28 AM
Member
 
Join Date: Nov 2007
Location: Hershey, PA
Posts: 13
padutch2 is on a distinguished road
Send a message via AIM to padutch2
oh ok i was thinking about useing cases but i forgot how they worked. thanks sir
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
file download abhiN New To Java 0 02-08-2008 10:10 AM
how to download using java leonard Advanced Java 1 08-06-2007 06:36 PM
Help with download java api fernando New To Java 1 08-06-2007 03:36 AM
I could download JDK 1.5 Albert New To Java 2 07-13-2007 04:36 PM
Download JDK 1.5 Nick15 New To Java 2 05-27-2007 10:52 AM


All times are GMT +3. The time now is 06:51 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org