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

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

View Full Document Right Arrow Icon
//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,
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online