Question
Exercise 3A [5%] Create a class called TextStatisticsDisplay. Extend this class from JComponent. Add a private variable of type TextStatistics. If you have not completed
Exercise 3A [5%] Create a class called TextStatisticsDisplay. Extend this class from JComponent. Add a private variable of type TextStatistics. If you have not completed Exercise 1 replace TextStatistics with an int array with 36 elements in all Exercises. Exercise 3B [5%] Add a constructor to the class that receives a TextStatistics parameter. Initialise the variable you created in 3A with this parameter. If you have not completed Exercise 1 initialise the int array with an int array parameter. Exercise 3C [25%] Override the paintComponent method. Draw a rectangle for each letter and number. The height of the rectangle should correspond to the frequency of this symbol. If an element has a frequency has 80 elements it does not have to be 80 pixels but can be a multiple e.g. 800 pixels. Each rectangle should be placed next to its neighbour. On top of each rectangle place the symbol whose frequency the rectangle represents followed by a colon, a space and the frequency. E.g. if the e occurred 83 times in the text you should write e: 83 over the corresponding bar. See Figure 1 for an example. If you did not complete Exercise 1 use the values from the int array.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started