X-Git-Url: https://git.llucax.com/z.facultad/75.62/c2tp1.git/blobdiff_plain/cb7b74f218aaee0b5e517ff23e3a9ed54bff8ba4..refs/heads/master:/src/Cantadores.java?ds=inline diff --git a/src/Cantadores.java b/src/Cantadores.java index 376d0e7..3511800 100644 --- a/src/Cantadores.java +++ b/src/Cantadores.java @@ -1,19 +1,35 @@ import java.util.*; -public class Cantadores implements Observer +public class Cantadores extends Observable implements Observer { String nombre; + int n; + public Cantadores (String s) { nombre = s; } + public int getLastN () + { + return n; + } + + public String getNombre () + { + return nombre; + } + public void update(Observable obs, Object obj) { if (obs instanceof Sorteo) { Sorteo s = (Sorteo)obs; - if ((s.getN()>=40) && (s.getN()<=49)) + if ((s.getN()>=40) && (s.getN()<=49)) { System.out.println ("Canto "+nombre+" "+s.getN()); + n = s.getN(); + setChanged (); + notifyObservers (); + } } else { System.out.println ("E"); }