diff --git a/.gitignore b/.gitignore index 1e4cb7e..fb9a6bf 100644 --- a/.gitignore +++ b/.gitignore @@ -188,3 +188,7 @@ /Semester 3/Assignments/MP5-Binary-Files_CalebFontenot2/MP5-Binary-Files_CalebFontenot/nbproject/private/ /Semester 3/Assignments/MP5-Binary-Files_CalebFontenot/build/ /Semester 3/Assignments/MP5-Binary-Files_CalebFontenot/nbproject/private/ +/Semester 3/Assignments/TestHashCode/nbproject/private/ +/Semester 3/Assignments/TestHashCode/build/ +/Semester 3/Assignments/LinkedList/nbproject/private/ +/Semester 3/Assignments/LinkedList/build/ diff --git a/Semester 3/Assignments/LinkedList/build.xml b/Semester 3/Assignments/LinkedList/build.xml new file mode 100644 index 0000000..3bd73cf --- /dev/null +++ b/Semester 3/Assignments/LinkedList/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project LinkedList. + + + diff --git a/Semester 3/Assignments/LinkedList/manifest.mf b/Semester 3/Assignments/LinkedList/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/Semester 3/Assignments/LinkedList/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/Semester 3/Assignments/LinkedList/nbproject/build-impl.xml b/Semester 3/Assignments/LinkedList/nbproject/build-impl.xml new file mode 100644 index 0000000..905cc16 --- /dev/null +++ b/Semester 3/Assignments/LinkedList/nbproject/build-impl.xml @@ -0,0 +1,1771 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Semester 3/Assignments/LinkedList/nbproject/genfiles.properties b/Semester 3/Assignments/LinkedList/nbproject/genfiles.properties new file mode 100644 index 0000000..14564e4 --- /dev/null +++ b/Semester 3/Assignments/LinkedList/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=574b29ce +build.xml.script.CRC32=5a2d809d +build.xml.stylesheet.CRC32=f85dc8f2@1.108.0.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=574b29ce +nbproject/build-impl.xml.script.CRC32=e24591ae +nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.108.0.48 diff --git a/Semester 3/Assignments/LinkedList/nbproject/project.properties b/Semester 3/Assignments/LinkedList/nbproject/project.properties new file mode 100644 index 0000000..cdc8ed7 --- /dev/null +++ b/Semester 3/Assignments/LinkedList/nbproject/project.properties @@ -0,0 +1,95 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.modulepath=\ + ${run.modulepath} +debug.test.classpath=\ + ${run.test.classpath} +debug.test.modulepath=\ + ${run.test.modulepath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/LinkedList.jar +dist.javadoc.dir=${dist.dir}/javadoc +dist.jlink.dir=${dist.dir}/jlink +dist.jlink.output=${dist.jlink.dir}/LinkedList +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.modulepath= +javac.processormodulepath= +javac.processorpath=\ + ${javac.classpath} +javac.source=20 +javac.target=20 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.modulepath=\ + ${javac.modulepath} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.html5=false +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +# The jlink additional root modules to resolve +jlink.additionalmodules= +# The jlink additional command line parameters +jlink.additionalparam= +jlink.launcher=true +jlink.launcher.name=LinkedList +main.class=linkedlist.LinkedList +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.modulepath=\ + ${javac.modulepath} +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +run.test.modulepath=\ + ${javac.test.modulepath} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/Semester 3/Assignments/LinkedList/nbproject/project.xml b/Semester 3/Assignments/LinkedList/nbproject/project.xml new file mode 100644 index 0000000..6c6d94c --- /dev/null +++ b/Semester 3/Assignments/LinkedList/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + LinkedList + + + + + + + + + diff --git a/Semester 3/Assignments/LinkedList/src/linkedlist/MyList.java b/Semester 3/Assignments/LinkedList/src/linkedlist/MyList.java new file mode 100644 index 0000000..f181a7e --- /dev/null +++ b/Semester 3/Assignments/LinkedList/src/linkedlist/MyList.java @@ -0,0 +1,150 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package linkedlist; + +import java.util.LinkedList; + +/** + * + * @author caleb + */ +public class MyList { + + private Node head; + + class Node { + + E e; // Data than can be anything + Node link; // Address of another node + + } + + public boolean add(E e) + { + Node newNode = new Node(); + newNode.e = e; + + if (head == null) { + head = newNode; + } else { + Node p = head; + Node pTrail = head; + while (p != null) { + pTrail = p; + p = p.link; + } + pTrail.link = newNode; + } + return true; + } + + public boolean add(E e, int index) { + Node newNode = new Node(); + newNode.e = e;//copy data + + //Check index location + if (index < 0 || index > size()) { + throw new IndexOutOfBoundsException(); + } + + //Case 1: list is empty and the index is zero + if (size() == 0 && index == 0) { + head = newNode; + } //Case 2: Add at front + else if (index == 0) { + //Connect newNode with the first node + newNode.link = head; + //Make head point to new node + head = newNode; + } + //Case 3: Add in middle + else if (index < size()) + { + Node p = head; + for (int i = 0; i < index - 1; ++i) + { + p = p.link;//advance the p + } + //Point link of new node to next node + newNode.link = p.link; + //make previous node link point to new node + p.link = newNode; + } + //Case 4: Add at end of list + else { + add(e); + } + return true; + } + + @Override + public String toString() + { + String s = ""; + Node p = head; + while (p != null) { + s += p.e.toString() + " "; + p = p.link; + } + return "MyList{" + s + "}"; + } + + public int size() + { + int count = 0; + Node p = head; + while (p != null) { + ++count; + p = p.link; + } + return count; + } + + public E removeAt(int index) { + if (index < 0 || index >= size()) + throw new IndexOutOfBoundsException(); + if (size() == 0) + throw new RuntimeException("Empty List"); + E removedE = null; + if (index == 0) { + // remove the front + removedE = head.e; + Node p = head; + head = head.link; + p.link = null; + } + if (index > 0 && index < size()) { // remove middle + Node p = head; + for (int i = 0; i < index - 1; ++i) { + p = head.link; + } + removedE = p.link.e; + p.link = p.link.link; + } else { // Remove at end + Node p = head; + for (int i = 0; i < index -1; ++i) { + p = p.link; + removedE = p.link.e; + p.link = null; + } + } + return removedE; + } + + public static void main(String[] args) + { + LinkedList linkedList = new LinkedList<>(); + MyList ml = new MyList<>(); + ml.add(10); + ml.add(20); + ml.add(30); + ml.add(5, 0); + ml.add(25, 3); + ml.add(40, 5); + System.out.println("removing " + ml.removeAt(2) + "..."); + System.out.println(ml); + System.out.println(ml.size()); + } +} diff --git a/Semester 3/Assignments/TestHashCode/build.xml b/Semester 3/Assignments/TestHashCode/build.xml new file mode 100644 index 0000000..16df9da --- /dev/null +++ b/Semester 3/Assignments/TestHashCode/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project TestHashCode. + + + diff --git a/Semester 3/Assignments/TestHashCode/manifest.mf b/Semester 3/Assignments/TestHashCode/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/Semester 3/Assignments/TestHashCode/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/Semester 3/Assignments/TestHashCode/nbproject/build-impl.xml b/Semester 3/Assignments/TestHashCode/nbproject/build-impl.xml new file mode 100644 index 0000000..df614d8 --- /dev/null +++ b/Semester 3/Assignments/TestHashCode/nbproject/build-impl.xml @@ -0,0 +1,1771 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Semester 3/Assignments/TestHashCode/nbproject/genfiles.properties b/Semester 3/Assignments/TestHashCode/nbproject/genfiles.properties new file mode 100644 index 0000000..bec4cc8 --- /dev/null +++ b/Semester 3/Assignments/TestHashCode/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=37d3182d +build.xml.script.CRC32=cfde4771 +build.xml.stylesheet.CRC32=f85dc8f2@1.108.0.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=37d3182d +nbproject/build-impl.xml.script.CRC32=10f7f466 +nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.108.0.48 diff --git a/Semester 3/Assignments/TestHashCode/nbproject/project.properties b/Semester 3/Assignments/TestHashCode/nbproject/project.properties new file mode 100644 index 0000000..73afb6c --- /dev/null +++ b/Semester 3/Assignments/TestHashCode/nbproject/project.properties @@ -0,0 +1,95 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.modulepath=\ + ${run.modulepath} +debug.test.classpath=\ + ${run.test.classpath} +debug.test.modulepath=\ + ${run.test.modulepath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/TestHashCode.jar +dist.javadoc.dir=${dist.dir}/javadoc +dist.jlink.dir=${dist.dir}/jlink +dist.jlink.output=${dist.jlink.dir}/TestHashCode +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.modulepath= +javac.processormodulepath= +javac.processorpath=\ + ${javac.classpath} +javac.source=20 +javac.target=20 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.modulepath=\ + ${javac.modulepath} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.html5=false +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +# The jlink additional root modules to resolve +jlink.additionalmodules= +# The jlink additional command line parameters +jlink.additionalparam= +jlink.launcher=true +jlink.launcher.name=TestHashCode +main.class=testhashcode.TestHashCode +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.modulepath=\ + ${javac.modulepath} +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +run.test.modulepath=\ + ${javac.test.modulepath} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/Semester 3/Assignments/TestHashCode/nbproject/project.xml b/Semester 3/Assignments/TestHashCode/nbproject/project.xml new file mode 100644 index 0000000..4eed752 --- /dev/null +++ b/Semester 3/Assignments/TestHashCode/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + TestHashCode + + + + + + + + + diff --git a/Semester 3/Assignments/TestHashCode/src/testhashcode/TestHashCode.java b/Semester 3/Assignments/TestHashCode/src/testhashcode/TestHashCode.java new file mode 100644 index 0000000..9572d10 --- /dev/null +++ b/Semester 3/Assignments/TestHashCode/src/testhashcode/TestHashCode.java @@ -0,0 +1,21 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template + */ +package testhashcode; + +/** + * + * @author caleb + */ +public class TestHashCode { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) + { + // TODO code application logic here + } + +} diff --git a/Semester 3/Assignments/TestHashCode/src/testhashcode/TestHashSet.java b/Semester 3/Assignments/TestHashCode/src/testhashcode/TestHashSet.java new file mode 100644 index 0000000..41a6d29 --- /dev/null +++ b/Semester 3/Assignments/TestHashCode/src/testhashcode/TestHashSet.java @@ -0,0 +1,39 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package testhashcode; + +/** + * + * @author caleb + */ +import java.util.*; + +public class TestHashSet { + public static void main(String[] args) { + // Create a hash set + Set set = new HashSet<>(); + + // Add strings to the set + set.add("London"); + set.add("Paris"); + set.add("New York"); + set.add("San Francisco"); + set.add("Beijing"); + set.add("New York"); + set. + + System.out.println(set); + + // Display the elements in the hash set + for (String s: set) { + System.out.print(s.toUpperCase() + " "); + } + + // Process the elements using a forEach method + System.out.println(); + set.forEach(e -> System.out.print(e.toLowerCase() + " ")); + System.out.println(); + } +} \ No newline at end of file