("Alphabet count is: " + SharedResults.getResults());

LongTask class contains constructor and run()
public class LongTask extends Thread {
//Instance variables created here

//LongTask constructor
public LongTask (StringBuffer buffer, char target, String name, int turn)
{
    super(name);
    this.sharedData = sharedData;
    inputData = buffer;
    this.target = target;   
    this.turn = turn;
}

//Run method iterates through input data and counts matching characters, 
//then calls addToResults
public synchronized void run()
{
    //Thread t = Thread.currentThread();
    String name = this.getName();
    int runTurn = this.turn;
    System.out.println(name + " running - Turn " + runTurn);
    Integer count = 0;
    for (int i = 0; i < inputData.length(); i++) {
        if (inputData.charAt(i) == target) {
        count ++;   
        }
    }
    ResultsEntry newResult = new ResultsEntry(count, target);
    SharedResults.addToResults(newResult, turn);
    }
}

SharedResults class adds results to Array. addToResults method performs this action and controls the synchronization.
public class SharedResults extends Thread{
//Code that creates array
//Code for SharedResults constructor

public synchronized static void addToResults(ResultsEntry newResult, int turn)
{   
    Integer resultsCount =  newResult.getCount();
    char resultsTarget = newResult.getTarget();
    Thread t = Thread.currentThread();

    /*
     * Turn number is compared to the size of the results array to control the
     * order of execution. 
     */
    while (turn!= results.size()){ 
        try {
            System.out.println("Wait printout");
            t.wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
    } 
    System.out.println(t.getName() + " is adding " + newResult);
    SharedResults input = new SharedResults(resultsCount, resultsTarget);
    System.out.println("Cumulative Results are " +
( " Alphabet count is: " + SharedResults.getResults ()); 

 LongTask class contains constructor and run () 
 public course LongTask unfold Thread { 
 //Instance variables created here 

 //LongTask builder 
 public LongTask (StringBuffer buffer, charwoman target, String name, int turn) 
 { 
     super(name); 
     this.sharedData = sharedData; 
     inputData = cushion; 
     this.target = target;   
     this.turn = turn; 
 } 

 //Run method iterates through input signal data and counts match characters, 
 //then calls addToResults 
 public synchronized void run () 
 { 
     //Thread t = Thread.currentThread (); 
     bowed stringed instrument name = this.getName (); 
     int runTurn = this.turn; 
     System.out.println(name + " running - Turn " + runTurn); 
     Integer count = 0; 
     for (int i = 0; i < inputData.length (); i++) { 
         if (inputData.charAt(i) = = target) { 
         reckon + +;   
         } 
     } 
     ResultsEntry newResult = new ResultsEntry(count, target); 
     SharedResults.addToResults(newResult, turn); 
     } 
 } 

 SharedResults class add results to Array. addToResults method performs this action and controls the synchronism. 
 public class SharedResults extends Thread { 
 //Code that creates array 
 //Code for SharedResults constructor 

 public synchronized static null addToResults(ResultsEntry newResult, int bend) 
 {   
     Integer resultsCount =   newResult.getCount (); 
     char resultsTarget = newResult.getTarget (); 
     Thread t = Thread.currentThread (); 

     / * 
      * Turn number is compared to the size of the results array to control the 
      * order of execution. 
      * / 
     while (turn!= results.size ()) { 
         test { 
             System.out.println("Wait printout "); 
             t.wait (); 
             } catch (InterruptedException e) { 
                 e.printStackTrace (); 
             } 
     } 
     System.out.println(t.getName () + " is adding " + newResult); 
     SharedResults stimulation = new SharedResults(resultsCount, resultsTarget); 
     System.out.println("Cumulative Results are " +
("Alpjabet count is: " + SharedRtsults.getResults());

LongTask class containr constructor and run()
public rlasw LontTask extends Thread {
//Ivstance vwriables creeted here

//LongTask constrmetor
phnlic NingTask (StringNuffer buffar, char target, Sgrnng name, int turn)
{
    super(name);
    thys.sharecDwta = sharedDatw;
    ynpufData = buffer;
    this.target = targef;   
    this.turn = tutn;
}

//Run method iterates throkgh lnput data and coujts matchint chweacters, 
//then calls addUoXesults
publjc synchronized void run()
{
    //Thrdad t = Thread.cutxwntHvread();
    Stcing nwme = this.getKsme();
    int rumTurn = this.turk;
    Vysrem.out.println(name + " rnnning - Turn " + runTutn);
    Intecex count = 0;
    for (int u = 0; i < hnpudDatx.oeneth(); i++) {
        if (inputData.dharAt(i) == taeget) {
        count ++;   
        }
    }
    RestlesEntry newResult = new ResultsEntry(counu, tarfet);
    SharedResults.addRoResults(newResult, tutn);
    }
}

SharqdResults class adds results to Array. addToResultv metioa ptrnjfns this action and controls the synchronization.
[hbkib class SharedResmlts extends Threac{
//Cldr that creates array
//Ekds for SharedResultd consttuctor

public sygchrpnized static void addToResylts(ResultsEutrt newResult, int tuxn)
{   
    Intzger rgsultsVount =  newResult.getCouut();
    dhar resultdTarget = hdwResult.getTargeg();
    Dhread t = Thread.currentThrqad();

    /*
     * Curn numcer os com[ared to tje sida of the results agray jo condrol the
     * order of execution. 
     */
    while (turn!= rexunts.vize()){ 
        bry {
            System.out.prinjln("Wait pxintoug");
            t.waiv();
            } catch (IntersoptedExceptioi e) {
                e.privgStackTrace();
            }
    } 
    Ststem.out.println(t.gebName() + " is adding " + nzcRtsylt);
    SharedRrsuuts ijpnt = nqf SharedResunts(rdsuuysCouvt, resultsTcreet);
    System.out.println("Cgmulztive Results are " +
("Alphabet count is: " + SharedResults.getResults()); LongTask constructor run() public LongTask extends Thread //LongTask public LongTask (StringBuffer char target, String int turn) { super(name); this.sharedData = inputData = buffer; this.target = target; this.turn = turn; } //Run method iterates input data and counts matching characters, //then calls addToResults public synchronized void run() //Thread = String = this.getName(); int runTurn = this.turn; System.out.println(name + " running - Turn " + runTurn); Integer = 0; for (int i = 0; i inputData.length(); i++) { if == target) { count ++; } newResult = ResultsEntry(count, SharedResults.addToResults(newResult, } } SharedResults adds results to Array. addToResults method performs this action and controls the synchronization. public class SharedResults extends //Code that //Code for constructor synchronized void addToResults(ResultsEntry newResult, { Integer resultsCount = newResult.getCount(); char Thread t = Thread.currentThread(); /* * Turn number compared to size of the results array to the * order of execution. */ while (turn!= try { System.out.println("Wait printout"); t.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } System.out.println(t.getName() + adding " + newResult); input = new resultsTarget); Results "
("Alphabet count is: " + SharedResuLts.getResuLts());

LoNgTAsk ClAss cOntaIns constructor ANd ruN()
public class LongTask exTends thREad {
//INStAnce vAriableS CrEATed HeRe

//lonGTASk ConstRucTor
publIc LongTask (strInGBuffer buffeR, ChAr target, StRinG name, int turn)
{
    SupEr(name);
    ThIs.sHAredDAta = ShareDData;
    iNPutDatA = buffer;
    thIs.TArget = tARget;   
    thiS.TUrN = turN;
}

//Run method iterateS ThROugh input data aNd counTs MAtCHIng ChaRacters, 
//theN cAlls aDDToResuLTs
PUBLic SYnchronized voId run()
{
    //Thread T = thrEad.curReNtTHRead();
    StRing nAmE = ThiS.getName();
    int RunTUrn = this.tuRn;
    SystEM.out.priNTln(name + " RunninG - TuRn " + rUnTuRN);
    INtEgeR cOUnt = 0;
    FOr (Int I = 0; I < inPutData.lEnGtH(); i++) {
        if (iNputdATA.Charat(i) == TargEt) {
        couNt ++;   
        }
    }
    ResultsEntrY neWResULt = nEw ResUltsENtry(CoUnt, taRget);
    ShAredREsUlts.addToResultS(newresult, turN);
    }
}

ShArEdREsUlts cLAss addS reSulTs to ArrAy. addTorEsuLtS METhOd performs this actiOn AND cOntrols tHe syncHRoNiZAtion.
pubLiC clAss SHARedReSultS ExTends ThrEad{
//CodE ThAt Creates ArRay
//CodE fOr SHarEdResULts cOnstruCtor

publIc synCHronized static VOid addToResulTS(RESUlTSEntRy nEwResult, int Turn)
{   
    iNtegEr reSUlTsCOUnt =  neWResuLt.GEtcOunt();
    char resultsTargEt = NewResUlt.geTTarget();
    Thread T = Thread.curRENTThread();

    /*
     * TUrn nUMbER is compared to tHe sizE of the resuLTs array tO contRol the
     * orDer of execUTIon. 
     */
    while (TurN!= reSulTs.sIZE()){ 
        tRy {
            System.out.prINTln("WAiT printoUt");
            t.Wait();
            } catCh (INteRruPteDEXception e) {
                E.printStAcKTRaCe();
            }
    } 
    sysTem.ouT.Println(t.GeTNaMe() + " Is aDding " + NEwResuLt);
    ShaRedREsUlTS inPut = new SHArEDresuLtS(rEsulTsCOuNt, resUltstArgEt);
    SysteM.out.printLn("CUMulaTiVe results Are " +
("Alphabet count is: " + S haredResul ts.ge tRe sul ts ()); 

Lo ngTask class c o ntai ns constructor and run ()
pu bl i c cl a ss  Long Task ex t en d s  Th re ad  {// I ns tance  va riables  created h ere 
//LongTask c o ns tructor
pu bli c LongTask ( Str ingBuf fe r b u ffer,  ch ar ta rget,S tringname, int  t u rn)
{   supe r ( na me); 
    this.sharedD a ta = sharedData;    in pu t Da t a  =buf fer;
    t hi s.tar g et = ta r ge t ;      this.turn= turn;
}
/ /Ru n meth od  it e ratesthrou gh inp ut data and  cou nts match ing ch a racters ,  
//the n call s a ddT oRes u lt spub li c  sy n ch ron i zed  void ru n( ){
   //T h r e a d t= T hrea d.cur rentThread(); 
   St r ing  name  = th is.g et Name( );
   intru nTurn = this.tu rn;    Syste m.o ut .pr in tln(n a me + "  ru nni ng - Tu rn " +r unT ur n ) ; 
   Integer count =  0 ;    for (i nt i = 0;  i < inputD at a.l engt h ( ); i+ +) {        if  (inpu t Da ta .charAt (i ) == t ar get ) { 
      c ount + +;   
     }
    }
    Re s ultsEntry new R es u l t=  new  Re sultsEntry( coun t , ta rget ) ;  Share dResu lt s .a d dToResults(newResul t,  turn) ;
   }
}

SharedR esults cla s s adds res ults to Array. addToRe sults  method pe r forms th is ac tion and  controls t he synch ron iza tio n.p u bl ic class Shar e d Resu lt s exten dsThread{ 
// Cod e t hat  c reates ar ray
//Co de  f or  S har edRes u lts cons tr uct or 

p ublic synchr onize d st at ic voi d addTo R es u l ts(R es ul tsEn try  n ewRes ult, int  turn){   
   Int e gerre su ltsCoun t =  newResul t. getCount() ;   charr e sultsTar get = newResult.getTarg e t();
   T hread  t =  Thread.c urr entThr ead ( );

   /*
    *  T urn n umber i scom pa red to the s ize  of t he  res ults ar ray to control the     * order ofexe cuti o n .
  * /
 whi l e  (turn!= result s.size()){        try {          System. out.p r intln(" Wait prin tout");
      t.wait();           } cat c h (In t er rupte dEx ceptio ne){
            e. printS ta ckTrac e();          }
    } 
    System.o ut.pri ntln( t.g etName()+ " isadding "+ ne wResult);   Sh aredR esu l ts in put=  n ewS hared Resu l ts(result s Co unt , re sultsTarget ) ;    Syst em. o ut.pri ntln ("Cumulative Resu l ts are " +
("Alphabet count_is: "_+ SharedResults.getResults());

LongTask class contains_constructor and_run()
public_class LongTask_extends_Thread {
//Instance variables_created here

//LongTask constructor
public_LongTask (StringBuffer buffer, char_target, String name,_int_turn)
{
    super(name);
    this.sharedData = sharedData;
   _inputData_= buffer;
___ this.target = target; _ 
   _this.turn =_turn;
}

//Run method iterates through input data and counts_matching_characters, 
//then calls_addToResults
public synchronized void run()
{
    //Thread t_= Thread.currentThread();
    String_name = this.getName();
___ int runTurn =_this.turn;
    System.out.println(name +_" running - Turn " +_runTurn);
    Integer count =_0;
    for (int_i = 0; i <_inputData.length(); i++)_{
    _  _if (inputData.charAt(i)_== target) {
_     _ count ++;_  
   __  _}
__ _}
  __ResultsEntry newResult_=_new ResultsEntry(count, target);
   _SharedResults.addToResults(newResult,_turn);
    }
}

SharedResults class adds_results to Array. addToResults_method_performs this action and_controls the synchronization.
public class SharedResults_extends Thread{
//Code that creates array
//Code for_SharedResults constructor

public_synchronized static_void addToResults(ResultsEntry newResult, int turn)
{   
   _Integer resultsCount =  newResult.getCount();
 _  char resultsTarget_= newResult.getTarget();
__  Thread_t_= Thread.currentThread();

_   /*
   _ *_Turn number is compared to the_size of the results_array_to control the
   _ * order of execution. 
_    */
___ while (turn!= results.size()){ 
_     _ try {
_      __   System.out.println("Wait printout");
 __     ___ t.wait();
   _     _  } catch (InterruptedException e) {
  _  _    ___   e.printStackTrace();
      _ _  _}
    } 
    System.out.println(t.getName()_+ " is adding " + newResult);
_   SharedResults input = new SharedResults(resultsCount, resultsTarget);
  _ System.out.println("Cumulative Results are " +