//import java.util.concurrent.locks;


public class Score 
{
  private double score;
  private double total;
  private Lock lock = new Lock();

  public void setScore ( double s )
  {
         try {
          Thread.sleep( (int) ( Math.random() * 1000 ) );
        } catch ( InterruptedException e ) {
          e.printStackTrace();
        }
    try {  
      lock.lock(); 
    } catch ( InterruptedException e ) {
          e.printStackTrace();
     }
    score = s;
    lock.unlock();
  } 
  
  public synchronized void addScore ( double s )
  {
    total += s;
  }

  public synchronized void updateScore ( double s )
  { 
     score += s;
    notifyAll ();
  }

  public  double getScore ()
  {
    return score;
  }
}
