Software Design Laboratory Exercise #3 Solution

$35.00 $24.00

  Implement a Java class Pie Chart that displays a pie chart of the probabilities of then most frequent occurrences of an event to be specified in part 3 of the exercise. The probability of event is given by the equation:       Probability ofevent= Frequency of event     ∑Frequencies of all events…

You’ll get a: . zip file solution

 

 
Categorys:

Description

5/5 – (2 votes)

 

  1. Implement a Java class Pie Chart that displays a pie chart of the probabilities of then most frequent occurrences of an event to be specified in part 3 of the exercise. The probability of event is given by the equation:

 

 

 

Probability ofevent=

Frequency of event

 

 

∑Frequencies of all events

 

 

In the pie chart:

 

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

 

 

 

Probability of event=

 

  1. Each segment has a different color;

Centralangleofsegnent2n

 

  • Each segment has a legend showing the event and its probability;
  1. The segments are displayed in order decreasing probability;
  2. The last segment represents “All Other Events” and their cumulative probability. For 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 isoneminus the sum of the probabilities of eventse,s, andi;

 

  1. The Pie Chart class includes appropriate constructors and a method draw that draws the pie chart. The drawing pane should include appropriate GUI components to input the number of events,n,and display the pie chart together with the events probabilities. You may amend and use the class hierarchy in previous exercises, but in any case you may only use Java FX graphics and your own classes and methods for the operations

 

 

  1. Implement a Java class Histogram Letters that calculates then most frequent letters in “Emma” by Jane Austen (filetxt) and their probabilities. The Histogram Letters class utilizes the drawing pane above to draw a pie chart of the letter probabilities.