package CUTexamples; import java.util.*; public class TriFloats { private List members = new LinkedList() ; private String name ; private int updates ; public TriFloats(String name) { this.name = name ; updates = 0 ; } public boolean add(Float x) { if (x > 1.5f) return false ; if (members.contains(x)) return false ; if (members.size() >= 3) return false ; members.add(x) ; updates++ ; return true ; } public boolean remove(Float x) { if (members.contains(x)) { members.remove(new Float(x)) ; updates++ ; return true ; } return false ; } }