setd - System.out.println(set1.contains(2.4)); // should...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class setd { public static void main(String[] args) { boolean success; Set set1 = new Set(3); success = set1.add(4.0); System.out.println(success); // should print "true" success = set1.add(9.0); System.out.println(success); // should print "true" success = set1.add(2.0); System.out.println(success); // should print "true" success = set1.add(2.4); System.out.println(success); // should print "false" System.out.println(set1.contains(9.0)); // should print "true"
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.println(set1.contains(2.4)); // should print "false" System.out.println(set1.toString()); // should print "{4.0, 9.0, 2.0}" Set set2 = new Set(1000); set2.add(3.0); set2.add(2.0); set2.add(8.0); set2.add(4.0); Set set3 = set1.difference(set2); System.out.println(set3.toString()); // should print "{4.0, 2.0}" } }...
View Full Document

This note was uploaded on 07/12/2009 for the course CS 111 taught by Professor Hari during the Fall '08 term at Rutgers.

Ask a homework question - tutors are online