[Java Newbie] Histogram

P

proGex

A good place for you to start learning the language is from Sun
http://java.sun.com/learning/new2java/index.html

Here is one of the many ways you can do it

1. get the first character of the string, loop through the string and
count the number of matching character you find. Remove all the
matching character from the string. [Consider using StringBuffer]

2. output the count for the character

3. repeat 1 if string is not empty

Use the API reference to help you
http://java.sun.com/j2se/1.4.2/docs/api/

Also, the Histogram class is for graphics in Java Advanced Imaging, it
is not used the way as you think it might be (graph histogram).

If you really need to draw a histogram, you have to use other libraries
out there like JFreeChart (www.jfree.org/jfreechart/) to render the
histogram. At this stage since you are new to Java, I suggest you get
the main work done first and output your result using System.out
 
J

jacky.newsgroup

thanks!! I've completed the main body! :)

Going to explore something else!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top