<?xml version="1.0" encoding="UTF-8" standalone="no"?><umlet_diagram><help_text>// Uncomment the following line to change the fontsize:
// fontsize=14


//////////////////////////////////////////////////////////////////////////////////////////////
// Welcome to UMLet!
//
// Double-click on UML elements to add them to the diagram, or to copy them
// Edit elements by modifying the text in this panel
// Hold Ctrl to select multiple elements
// Use Ctrl+mouse to select via lasso
//
// Use ± or Ctrl+mouse wheel to zoom
// Drag a whole relation at its central square icon
//
// Press Ctrl+C to copy the whole diagram to the system clipboard (then just paste it to, eg, Word)
// Edit the files in the "palettes" directory to create your own element palettes
//
// Select "Custom Elements &gt; New..." to create new element types
//////////////////////////////////////////////////////////////////////////////////////////////


// This text will be stored with each diagram;  use it for notes.</help_text><zoom_level>10</zoom_level><element><type>com.umlet.element.base.Class</type><coordinates><x>270</x><y>570</y><w>390</w><h>240</h></coordinates><panel_attributes>
Main
bg=gray
--
static final int TRIALS_TO_RUN
 
ArrayList&lt;State&gt;  states
     -- just Indiana,
         or Indiana and its neighbors,
         or all fifty states plus DC,
         or potentially other lists of State's to simulate
 
--
_main_
     -- Uses its ArrayList&lt;State&gt; and its ElectionSimulator
     to run election simulations several times with different data
     (i.e. different states) and different numbers of trials.</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>280</x><y>40</y><w>400</w><h>380</h></coordinates><panel_attributes>ElectionSimulator
bg=gray
--
 
--
ElectionSimulator(ArrayList&lt;State&gt; states)
 
int getTotalElectoralVotes()
 
int runSimulation() - runs a single simulation (trial)
     and returns the number of votes that candidate A
     wins in the simulation
 
double[] runSimulations(int numberOfTrials) - runs
     the given number of simulations (trials) and returns
     an array whose value at index i is an estimate of
     the probability of candidate A winning i electoral votes
 
ArrayList&lt;Double&gt; probabilityABTie(int numberOfTrials)
     - uses the above to run the given number of
     simulations (trials) and returns an an ArrayList&lt;Double&gt;
     whose first value is the probability that A wins the
     election, second value is the probability that B wins the
     election, and third value is the probability of a tie</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>30</x><y>570</y><w>190</w><h>240</h></coordinates><panel_attributes>DataFromSept22
bg=yellow
--
 
private ArrayList&lt;State&gt;
_fiftyStatesPlusDC_
 
--
ArrayList&lt;State&gt;
_indiana()_
 
ArrayList&lt;State&gt;
_indianaNeighbors()_
 
ArrayList&lt;State
_ fiftyStatesPlusDC()_</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>370</x><y>390</y><w>210</w><h>200</h></coordinates><panel_attributes>lt=&lt;-
r1=                         constructs 1..*</panel_attributes><additional_attributes>110;30;110;180</additional_attributes></element><element><type>com.umlet.element.base.Note</type><coordinates><x>20</x><y>20</y><w>240</w><h>240</h></coordinates><panel_attributes>Note.. Students:
bg=blue
 
 -- You implement the gray classes.
 
 -- We supplied the yellow
     classes for you to use.
 
 -- We supplied the green JUnit test
     classes, to test your classes and
     the classes that we supplied.
 
Implement StateList first, then
ElectionSimulator, then Main.</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Note</type><coordinates><x>10</x><y>270</y><w>230</w><h>290</h></coordinates><panel_attributes>Key..
 
bg=pink
is-a, extends
 
is-a, implements
 
has-a
 (association)
 annotation indicates construction
 and/or multiplicity
 
uses
 (dependency)
 
underlined items are
/static/</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>90</x><y>280</y><w>140</w><h>50</h></coordinates><panel_attributes>lt=&lt;&lt;-</panel_attributes><additional_attributes>120;30;30;30</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>110</x><y>320</y><w>120</w><h>50</h></coordinates><panel_attributes>lt=&lt;&lt;.</panel_attributes><additional_attributes>100;30;30;30</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>80</x><y>360</y><w>140</w><h>50</h></coordinates><panel_attributes>lt=&lt;-</panel_attributes><additional_attributes>120;30;30;30</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>40</x><y>440</y><w>180</w><h>50</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>160;30;30;30</additional_attributes></element><element><type>com.umlet.element.base.Note</type><coordinates><x>270</x><y>480</y><w>190</w><h>70</h></coordinates><panel_attributes>Note..
bg=blue
Run Main as an Application
and/or use the JUnit tests</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>910</x><y>510</y><w>310</w><h>300</h></coordinates><panel_attributes>StateList
bg=gray
--
 
--
State[ ]
_inputStatesArray_
        (int numberOfStatesToObtain,
         Scanner scanner)
 
String
_printStatesArray_
        (State[ ]  states)
 
String
_showHistogramArray_
       (double [ ]   frequencyArray)
 
Plus methods the same as the above except
that they take ArrayList's instead of arrays.</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>870</x><y>60</y><w>360</w><h>330</h></coordinates><panel_attributes>State
bg=yellow
--
 
--
State(String   stateName,
        int   electoralVotes,
        double   percentOfVotersWhoPlanToVoteForA,
        double   percentOfVotersWhoPlanToVoteForB)
 
int getElectoralVotes()
 
String getName()
 
int  simulate() - simulates this State's election and
     returns the result.  A positive number indicates
     the number of electoral votes earned by
     candidate A.  A negative number indicates the
     number of electoral votes earned by candidate B.
 
String  toString() - return's this State's data as a String</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>600</x><y>400</y><w>52</w><h>60</h></coordinates><panel_attributes>lt=&lt;-
m1=      1</panel_attributes><additional_attributes>-10;90;-10;90</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>910</x><y>360</y><w>312</w><h>170</h></coordinates><panel_attributes>lt=&lt;.
                                      uses toString() to
                                      display
                                      a single State</panel_attributes><additional_attributes>160;30;160;150</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>650</x><y>260</y><w>240</w><h>122</h></coordinates><panel_attributes>lt=&lt;.
uses simulate()
to simulate the
election in a
single state</panel_attributes><additional_attributes>220;50;30;50</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>630</x><y>670</y><w>300</w><h>122</h></coordinates><panel_attributes>lt=&lt;.
uses
showHistogramArray()
to display the results
of the simulations</panel_attributes><additional_attributes>280;50;30;50</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>190</x><y>660</y><w>100</w><h>50</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>30;30;80;30</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>650</x><y>150</y><w>240</w><h>146</h></coordinates><panel_attributes>lt=&lt;.
uses
getElectoralVotes()
to get the number
of electoral votes
for a single state</panel_attributes><additional_attributes>220;50;30;50</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>580</x><y>490</y><w>140</w><h>30</h></coordinates><panel_attributes>ArrayList&lt;State&gt;
bg=yellow</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>470</x><y>490</y><w>312</w><h>118</h></coordinates><panel_attributes>lt=&lt;-
                                   gets them by using
                                   DataFromSept22
                                   or StateList
</panel_attributes><additional_attributes>160;30;160;80</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>770</x><y>430</y><w>190</w><h>50</h></coordinates><panel_attributes>ElectionSimulatorTest
(JUnit4 test class)
bg=green</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>700</x><y>70</y><w>90</w><h>70</h></coordinates><panel_attributes>StateTest
(JUnit4
test class)
bg=green</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>650</x><y>350</y><w>140</w><h>110</h></coordinates><panel_attributes>lt=&lt;.
     tests</panel_attributes><additional_attributes>30;30;120;90</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>720</x><y>80</y><w>134</w><h>70</h></coordinates><panel_attributes>lt=&lt;.
            tests</panel_attributes><additional_attributes>70;40;70;40</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>680</x><y>610</y><w>130</w><h>70</h></coordinates><panel_attributes>StateListTest
(JUnit 4
test class)
bg=green</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>780</x><y>590</y><w>150</w><h>70</h></coordinates><panel_attributes>lt=&lt;.
tests</panel_attributes><additional_attributes>130;50;30;50</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>440</x><y>390</y><w>312</w><h>120</h></coordinates><panel_attributes>lt=&lt;-
                                   gets it
                                     via its constructor
m1=        1
</panel_attributes><additional_attributes>160;100;160;30</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>760</x><y>80</y><w>130</w><h>100</h></coordinates><panel_attributes>lt=&lt;.
   tests</panel_attributes><additional_attributes>110;80;30;30</additional_attributes></element></umlet_diagram>