[SOLVED] Lab 13 Java Programming

25.00 $

Category:

Description

5/5 - (1 vote)

1. Declare and implement a class named Histogram. This class will have a string data member and the following methods:

Data members:

String text

Methods:

constructor – initialize text with “I love problem-solving.”.

setText(String t) – set text to t.

drawHistogram() – count each alphabet letter, store the counts in an array and plot the counts using a vertical histogram. As an example, if text = “I love problem-solving.”, this method should plot:

*     *

*       *     *     *             *

*     *   *   *     * * * * *   * *     *

—————————————————

a b c d e f g h i j k l m n o p q r s t u v w x y z

Note that all special characters including blanks are ignored and alphabet letters are case-insensitive.

 

Your main program should use the following menu:

T: Enter a text

P: Plot frequencies

Q: Quit

Select: