From 15a01d81fdde0c2984bfbb9f011d9995e0f43d5b Mon Sep 17 00:00:00 2001 From: Caleb Fontenot Date: Tue, 14 Feb 2023 19:29:36 -0600 Subject: [PATCH] MP3_REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE --- .gitignore | 2 + .../nbproject/build-impl.xml | 88 +++++++++----- .../nbproject/genfiles.properties | 6 +- .../nbproject/project.properties | 6 +- .../MP3_CalebFontenot/nbproject/project.xml | 1 + .../mp3_calebfontenot/MP3_CalebFontenot.java | 107 +++++++++++------- Semester 2/TestProject/pom.xml | 14 +++ .../testproject/StringBuilderTest.java | 24 ++++ .../testproject/TestProject.java | 53 +++++++++ 9 files changed, 227 insertions(+), 74 deletions(-) create mode 100644 Semester 2/TestProject/pom.xml create mode 100644 Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/StringBuilderTest.java create mode 100644 Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/TestProject.java diff --git a/.gitignore b/.gitignore index 3ad59e0..0068b18 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,5 @@ /Semester 2/Assignments/MyStack/target/ /ASDV-Help/Test/Test/target/ /Semester 2/Assignments/MP3_CalebFontenot/nbproject/private/ +/Semester 2/TestProject/target/ +/Semester 2/Assignments/MP3_CalebFontenot/build/ diff --git a/Semester 2/Assignments/MP3_CalebFontenot/nbproject/build-impl.xml b/Semester 2/Assignments/MP3_CalebFontenot/nbproject/build-impl.xml index e3a0543..f41b929 100644 --- a/Semester 2/Assignments/MP3_CalebFontenot/nbproject/build-impl.xml +++ b/Semester 2/Assignments/MP3_CalebFontenot/nbproject/build-impl.xml @@ -119,7 +119,43 @@ is divided into following sections: - + + + + + + + + + + + + + + + + + + + + + + + + + + Must set platform.home + Must set platform.bootcp + Must set platform.java + Must set platform.javac + + The J2SE Platform is not correctly set up. + Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. + Either open the project in the IDE and setup the Platform with the same name or add it manually. + For example like this: + ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.${platform.active}.home" in a .properties file) + or ant -Dplatforms.${platform.active}.home=<path_to_JDK_home> jar (where no properties file is used) + @@ -242,20 +278,6 @@ is divided into following sections: - - - - - - - - - - - - - - @@ -343,7 +365,7 @@ is divided into following sections: - + @@ -394,7 +416,7 @@ is divided into following sections: - + @@ -436,7 +458,7 @@ is divided into following sections: - + @@ -515,7 +537,7 @@ is divided into following sections: - + @@ -543,7 +565,7 @@ is divided into following sections: - + @@ -619,7 +641,7 @@ is divided into following sections: - + @@ -850,6 +872,9 @@ is divided into following sections: + + + @@ -899,7 +924,7 @@ is divided into following sections: - + @@ -933,7 +958,7 @@ is divided into following sections: - + @@ -965,7 +990,7 @@ is divided into following sections: - + @@ -1199,7 +1224,7 @@ is divided into following sections: To run this application from the command line without Ant, try: - java -jar "${dist.jar.resolved}" + ${platform.java} -jar "${dist.jar.resolved}" @@ -1301,8 +1326,8 @@ is divided into following sections: - - + + @@ -1495,16 +1520,19 @@ is divided into following sections: + + + - + - + - + diff --git a/Semester 2/Assignments/MP3_CalebFontenot/nbproject/genfiles.properties b/Semester 2/Assignments/MP3_CalebFontenot/nbproject/genfiles.properties index f6d5116..58a3018 100644 --- a/Semester 2/Assignments/MP3_CalebFontenot/nbproject/genfiles.properties +++ b/Semester 2/Assignments/MP3_CalebFontenot/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=af984b5c +build.xml.data.CRC32=fa6a89f2 build.xml.script.CRC32=3d30e549 build.xml.stylesheet.CRC32=f85dc8f2@1.105.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=af984b5c -nbproject/build-impl.xml.script.CRC32=19fda9dc +nbproject/build-impl.xml.data.CRC32=fa6a89f2 +nbproject/build-impl.xml.script.CRC32=12cf189c nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.105.0.48 diff --git a/Semester 2/Assignments/MP3_CalebFontenot/nbproject/project.properties b/Semester 2/Assignments/MP3_CalebFontenot/nbproject/project.properties index a7d5ffb..9f69764 100644 --- a/Semester 2/Assignments/MP3_CalebFontenot/nbproject/project.properties +++ b/Semester 2/Assignments/MP3_CalebFontenot/nbproject/project.properties @@ -1,9 +1,10 @@ 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 +application.title=MP3_CalebFontenot +application.vendor=caleb build.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: @@ -32,6 +33,7 @@ dist.jar=${dist.dir}/MP3_CalebFontenot.jar dist.javadoc.dir=${dist.dir}/javadoc dist.jlink.dir=${dist.dir}/jlink dist.jlink.output=${dist.jlink.dir}/MP3_CalebFontenot +endorsed.classpath= excludes= includes=** jar.compress=false @@ -75,7 +77,7 @@ main.class=mp3_calebfontenot.MP3_CalebFontenot manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF mkdist.disabled=false -platform.active=default_platform +platform.active=JDK_17 run.classpath=\ ${javac.classpath}:\ ${build.classes.dir} diff --git a/Semester 2/Assignments/MP3_CalebFontenot/nbproject/project.xml b/Semester 2/Assignments/MP3_CalebFontenot/nbproject/project.xml index 755c36f..17b9f40 100644 --- a/Semester 2/Assignments/MP3_CalebFontenot/nbproject/project.xml +++ b/Semester 2/Assignments/MP3_CalebFontenot/nbproject/project.xml @@ -4,6 +4,7 @@ MP3_CalebFontenot + diff --git a/Semester 2/Assignments/MP3_CalebFontenot/src/mp3_calebfontenot/MP3_CalebFontenot.java b/Semester 2/Assignments/MP3_CalebFontenot/src/mp3_calebfontenot/MP3_CalebFontenot.java index 33bcb8d..fd14ec9 100644 --- a/Semester 2/Assignments/MP3_CalebFontenot/src/mp3_calebfontenot/MP3_CalebFontenot.java +++ b/Semester 2/Assignments/MP3_CalebFontenot/src/mp3_calebfontenot/MP3_CalebFontenot.java @@ -15,7 +15,8 @@ public class MP3_CalebFontenot { /** * @param args the command line arguments */ - public static void main(String[] args) { + public static void main(String[] args) + { Scanner input = new Scanner(System.in); System.out.print("Enter the first complex number: "); double a = input.nextDouble(); @@ -39,7 +40,6 @@ public class MP3_CalebFontenot { System.out.println(c3.getRealPart()); System.out.println(c3.getImaginaryPart()); } -} @@ -50,59 +50,88 @@ class Complex { private double a; private double b; private final double i = Math.sqrt(-1); - public Complex() { + + public Complex() + { this.a = 0; } - public Complex(double a) { + public Complex(double a) + { this.a = a; this.b = 0; } - public Complex(double a, double b) { + public Complex(double a, double b) + { this.a = a; this.b = b; } - /** - * Get the value of b - * - * @return the value of b - */ - public double getB() { - return b; + public Complex add(double c, double d) + { + return new Complex(this.a + c, this.b + d); } - /** - * Set the value of b - * - * @param b new value of b - */ - public void setB(double b) { - this.b = b; + public Complex add(Complex obj) + { + return new Complex(this.a + obj.a, this.b + obj.b); } - /** - * Get the value of a - * - * @return the value of a - */ - public double getA() { - return a; + public Complex subtract(double c, double d) + { + return new Complex(this.a - c, this.b - d); } - - /** - * Set the value of a - * - * @param a new value of a - */ - public void setA(double a) { - this.a = a; + public Complex subtract(Complex obj) + { + return new Complex(this.a - obj.a, this.b - obj.b); } - - public double add(Complex c2) { - double result; - result = (this.a + (this.b * this.i) + (c2.a + (this.b * this.i)); - return result; + + public Complex multiply(double c, double d) + { + double r = this.a * c - this.b * d; + double i = this.a * d + this.b * c; + return new Complex(r, i); } + public Complex multiply(Complex obj) { + double r = this.a * obj.a - this.b * obj.b; + double i = this.a * obj.b + this.b * obj.a; + return new Complex(r, i); + } + + public Complex divide(double c, double d) + { + return new Complex(this.a / c, this.a - d); + } + public Complex divide(Complex obj) + { + double denominator = this.a * this.a + this.b * this.b; + double r = (this.a * obj.b + this.a * obj.b) / denominator; + double i = (this.b * obj.b - this.a * obj.b) / denominator; + return new Complex(r, i); + } + + + @Override + public String toString() + { + return a + " + " + b + "i"; + } + + public Complex clone() { + Complex obj = new Complex(this.a, this.b); + return obj; + } + + public double abs() { + return Math.abs(this. a + this.b); + } + + public double getRealPart() { + return this.a; + } + public double getImaginaryPart() { + return this.b; + } + } diff --git a/Semester 2/TestProject/pom.xml b/Semester 2/TestProject/pom.xml new file mode 100644 index 0000000..ae96541 --- /dev/null +++ b/Semester 2/TestProject/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.calebfontenot + TestProject + 1.0-SNAPSHOT + jar + + UTF-8 + 1.8 + 1.8 + com.calebfontenot.testproject.TestProject + + \ No newline at end of file diff --git a/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/StringBuilderTest.java b/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/StringBuilderTest.java new file mode 100644 index 0000000..51f53e7 --- /dev/null +++ b/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/StringBuilderTest.java @@ -0,0 +1,24 @@ +/* + * 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 com.calebfontenot.testproject; + +/** + * + * @author caleb + */ +public class StringBuilderTest { + public static void main(String[] args) + { + StringBuilder string = new StringBuilder("abcdefghijklmnopqrstuvwxyz"); + System.out.println(string.length()); + System.out.println(string); + string.append("Java"); + System.out.println(string); + string.insert(26, "INSERT"); + System.out.println(string); + string.append(true); + System.out.println(string); + } +} diff --git a/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/TestProject.java b/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/TestProject.java new file mode 100644 index 0000000..d2e16bb --- /dev/null +++ b/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/TestProject.java @@ -0,0 +1,53 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + */ +package com.calebfontenot.testproject; + +import java.math.BigInteger; + +/** + * + * @author caleb + */ +public class TestProject { + + public static void foo1(int x) + { + System.out.println(x); + } + + public static Integer foo2() + { + return 5; + } + + public static Integer foo3() + { + return new Integer("10"); + } + + /** + * public static void main(String[] args) { Integer i = new Integer(4); Integer j = 4; Integer k = new Integer(555); int intInt = Integer.parseInt("76000000"); + * + * System.out.println(Integer.MAX_VALUE); foo1(123); System.out.println(foo2().getClass().getName()); System.out.println(foo3()); } + * + */ + public static void printBigInteger(BigInteger[] arr) + { + for (BigInteger i = BigInteger.ZERO; + i.compareTo(new BigInteger(Integer.toString(arr.length)) + ) < 0; + i = i.add(BigInteger.ONE)) { + System.out.println(arr[i.intValue()]); + } + } + + public static void main(String[] args) + { + BigInteger[] arr = new BigInteger[3]; + arr[0] = BigInteger.ONE; + arr[1] = new BigInteger("123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789"); + arr[2] = new BigInteger("88"); + printBigInteger(arr); + } +}