Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I think I am done.. #7

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added out/production/FinalProject/Main.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
111 changes: 109 additions & 2 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,112 @@
import java.util.Scanner;

import edu.greenriver.sdev333.MathSet;
import edu.greenriver.sdev333.SeparateChainingHashTables;
import edu.greenriver.sdev333.BSTset;


public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
//System.out.println("Hello world!");
//string created to put in set
String testString = "I L O V E K U M A"; //9

MathSet<String> testOne = new SeparateChainingHashTables<>();


//scanner to add string to BSTSet
Scanner input = new Scanner(testString);

//testing isEmpty (true/false)
// System.out.println(testOne.isEmpty());

//loop to add the strings as keys to my testOne
while(input.hasNext()){
String key = input.next();
testOne.add(key);
}

//Test for MathSet
MathSet<String> testTwo = new SeparateChainingHashTables<>();
testTwo.add("I");
testTwo.add("t");
testTwo.add("i");
testTwo.add("S");
testTwo.add("W");
testTwo.add("h");
testTwo.add("a");
testTwo.add("T");
testTwo.add(("i"));
testTwo.add(("t"));
testTwo.add(("i"));
testTwo.add(("s"));


//testing all methods in mathSet: return int
System.out.println(testOne.size());

//returns boolean
System.out.println(testOne.contains("B"));
System.out.println(testOne.contains("R"));
System.out.println(testOne.contains("o"));
//
// System.out.println(testOne.isEmpty());
// System.out.println();
//
System.out.println("__________________________________");
//
// System.out.println();
// // and again on testTwo
System.out.println(testTwo.size());
System.out.println(testTwo.contains("A"));
System.out.println(testTwo.contains("K"));
System.out.println(testTwo.contains("a"));
System.out.println(testTwo.contains("T"));
System.out.println(testTwo.contains("z"));

System.out.println("__________________________________");
//
// System.out.println();
// // this is the testOne for union/intersection/different methods
MathSet<String> unionTester = testOne.union(testTwo);
System.out.println("union: testOne and testTwo");
for (String element: unionTester.keys()){
System.out.println(element);
}
System.out.println("__________________________________");
System.out.println("intersection: testOne and testTwo");
MathSet<String> intersectionTester = testOne.intersection((testTwo));
for (String element: intersectionTester.keys()){
System.out.println(element);
}
System.out.println("__________________________________");

System.out.println("difference: testOne and testTwo");
MathSet<String> differenceTester = testOne.difference((testTwo));
for (String element: differenceTester.keys()){
System.out.println(element);
}
}
}
}
//IN CLASS
//
////
//// //Create 2 sets
//// MathSet<String> set1 = new BSTset<>();
//// // add items to each of the sets (some same, some different)
//// set1.add("Ken");
//// set1.add("Tina");
////
// MathSet<String> set2 = new BSTset<>();
//
//
// MathSet<String> result1 = set1.union(set2);
// //test
// for (String key : result1.keys()) {
// System.out.println(key);
// }

//set intersection
//set union
//set difference

Loading