Description
- Implement a Java class MyPieChart that displays a pie chart of the probabilities of the n most frequent occurrences of an event to be specified in part 4 of the exercise. The probability of event is given by the equation:
πΉππππ’ππππ¦ππππ£πππ‘
ππππππππππ‘π¦ππππ£πππ‘ =
β πΉππππ’ππππππ πππππππ£πππ‘π
In the pie chart:
- The area of each segment is proportional to the probability of the corresponding event:
πΆπππ‘πππππππππππ ππππππ‘
ππππππππππ‘π¦ππππ£πππ‘ =
2π
- Each segment has a different color;
- Each segment has a legend showing the corresponding event and its
probability;
- The segments are displayed in order of decreasing or increasing probability;
- The last segment represents βAll Other Eventsβ and their cumulative probability. As an example, in the graph below where the event is the occurrence of a letter in a text:n = 3, and the probability of All Other Events is one minus the sum of the probabilities of eventse, s, and i;
- The MyPieChart class includes appropriate constructors and a method draw that draws the pie chart. The drawing canvas should include appropriate GUI components to input the number of events, n, and display the pie chart together with the events and their corresponding probabilities.
- The MyPieChart class may inherit or otherwise utilize the MyShape class hierarchy in previous exercises, but in any case you may only use JavaFX graphics and your own classes and methods for the operations included.
- Implement a Java class HistogramAlphaBet that calculates the n most frequent alphabet characters in βAlice’s Adventures in Wonderlandβ by Lewis Carroll (file Alice in Wonderland.txt) and their probabilities. The HistogramAlphaBet class utilizes a map collection for statistical calculations and the drawing canvas above to draw a pie chart of the probabilities.




