Hw2 - /Scott Dyl/COT3100H/Homework#2 import...

This preview shows pages 1–2. Sign up to view the full content.

//Scott Dyl //COT3100H //Homework #2 / import java.util.Scanner; import java.util.TreeSet; import java.util.Vector; i public class Hw2 { p public static void main(String[] args) { p TreeSet<Integer> setA = new TreeSet<Integer>(); TreeSet<Integer> setB = new TreeSet<Integer>(); T Scanner stdin = new Scanner(System.in); S System.out.println("//Scott Dyl\n" + "//COT3100H\n" + "//Homework #2\n"); + int x; System.out.println("Please eneter the elements in set A followed by -1"); - while(true) { x = stdin.nextInt(); if (x == -1) break; else setA.add(x); s } System.out.println("Please eneter the elements in set B followed by -1"); while(true) { x = stdin.nextInt(); if (x == -1) break; else setB.add(x); s } System.out.println("A union B = " + AUnionB(setA, setB)); System.out.println("A intersect B = " + AIntersectB(setA, setB)); System.out.println("A minus B = " + AMinusB(setA, setB)); System.out.println("A cross B = " + ACrossB(setA, setB)); S } public static TreeSet<Integer> AUnionB(TreeSet<Integer> setA,

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 09/16/2011.

Page1 / 3

Hw2 - /Scott Dyl/COT3100H/Homework#2 import...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online