[SOLVED] CSC22100 Exercise3

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Exercise3-vv9ifx.zip (1024.7 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (1 vote)

A demonstration of your application is required.

  1. 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:

  1. The area of each segment is proportional to the probability of the corresponding event:

𝐶𝑒𝑛𝑡𝑟𝑎𝑙𝑎𝑛𝑔𝑙𝑒𝑜𝑓𝑠𝑒𝑔𝑚𝑒𝑛𝑡

𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦𝑜𝑓𝑒𝑣𝑒𝑛𝑡 =

2𝜋

  1. Each segment has a different color;
  • Each segment has a legend showing the corresponding event and its

probability;

  1. The segments are displayed in order of decreasing or increasing probability;
  2. 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;
  3. 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.
  4. 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.
  5. 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.
  • Exercise3-vv9ifx.zip