diff --git a/.gitignore b/.gitignore index 97a929a..f907518 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,5 @@ /Exams/PracticeExamChapter6_CalebFontenot/nbproject/private/ /Exams/PracticeExamChapter6_CalebFontenot/build/ /Exams/PracticeExamChapter6_CalebFontenot/dist/ +/Assignments/lab13_CalebFontenot/nbproject/private/ +/Assignments/lab13_CalebFontenot/build/ diff --git a/Assignments/lab13_CalebFontenot/Bug1.html b/Assignments/lab13_CalebFontenot/Bug1.html new file mode 100644 index 0000000..741e086 --- /dev/null +++ b/Assignments/lab13_CalebFontenot/Bug1.html @@ -0,0 +1,39 @@ + + + +Bug1.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab13_CalebFontenot/src/lab13_calebfontenot/Bug1.java
+
+package lab13_calebfontenot;
+
+public class Bug1 {
+
+    public static void main(String[] args)
+    {
+        int count = 1;
+        while (count < 100) {
+            System.out.println("count: " + count);
+            count *= 2;
+        }
+    }
+    
+}
+
+
+ diff --git a/Assignments/lab13_CalebFontenot/Bug2.html b/Assignments/lab13_CalebFontenot/Bug2.html new file mode 100644 index 0000000..0e8d7f2 --- /dev/null +++ b/Assignments/lab13_CalebFontenot/Bug2.html @@ -0,0 +1,81 @@ + + + +Bug2.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab13_CalebFontenot/src/lab13_calebfontenot/Bug2.java
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package lab13_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author ASDV2
+ */
+public class Bug2
+{
+  public static void main(String[] args) 
+{
+          Scanner in = new Scanner(System.in);
+            int decimalNumber;
+            String binaryNumber;
+            System.out.print("Enter a positive integer: ");
+            decimalNumber = in.nextInt();
+            int x = 0;
+            if (decimalNumber <= 0)
+                  System.out.println("ERROR: entered integer is nonpositive.");
+            else {
+                  binaryNumber = "";
+                  // algorithm step by step
+                  // initial: binaryNumber = "", decimalNumber = 123
+                  // step 1 : binaryNumber = "1 ", decimalNumber = 61
+                  // step 2 : binaryNumber = "11 ", decimalNumber = 30
+                  // step 3 : binaryNumber = "011 ", decimalNumber = 15
+                  // step 4 : binaryNumber = "1011 ", decimalNumber = 7
+                  // step 5 : binaryNumber = "1 1011 ", decimalNumber = 3
+                  // step 6 : binaryNumber = "11 1011 ", decimalNumber = 1
+                  // step 6 : binaryNumber = "111 1011 ", decimalNumber = 0
+                  // stop   : (decimalNumber != x)
+
+                  while (decimalNumber != x) 
+                        {
+                            //> add spaces to separate 4-digit groups
+                        if (binaryNumber.length() % 5 == 0)
+                             binaryNumber = " " + binaryNumber;
+                            //> extract last digit in binary representation
+                            // and add it to binaryNumber
+                        binaryNumber = (decimalNumber % 2) + binaryNumber;
+                            //> cut last digit in binary representation
+                        decimalNumber /= 2;
+                  }
+                  System.out.println("Binary: " + binaryNumber);
+            }
+      }  
+  
+}
+
+
+ diff --git a/Assignments/lab13_CalebFontenot/build.xml b/Assignments/lab13_CalebFontenot/build.xml new file mode 100644 index 0000000..c58a822 --- /dev/null +++ b/Assignments/lab13_CalebFontenot/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project lab13_CalebFontenot. + + + diff --git a/Assignments/lab13_CalebFontenot/lab13-1-1.pdf b/Assignments/lab13_CalebFontenot/lab13-1-1.pdf new file mode 100644 index 0000000..407a34d Binary files /dev/null and b/Assignments/lab13_CalebFontenot/lab13-1-1.pdf differ diff --git a/Assignments/lab13_CalebFontenot/manifest.mf b/Assignments/lab13_CalebFontenot/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/Assignments/lab13_CalebFontenot/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/Assignments/lab13_CalebFontenot/nbproject/build-impl.xml b/Assignments/lab13_CalebFontenot/nbproject/build-impl.xml new file mode 100644 index 0000000..3310d24 --- /dev/null +++ b/Assignments/lab13_CalebFontenot/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/Assignments/lab13_CalebFontenot/nbproject/genfiles.properties b/Assignments/lab13_CalebFontenot/nbproject/genfiles.properties new file mode 100644 index 0000000..f9a249f --- /dev/null +++ b/Assignments/lab13_CalebFontenot/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=d99ba26f +build.xml.script.CRC32=0e90d333 +build.xml.stylesheet.CRC32=f85dc8f2@1.104.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=d99ba26f +nbproject/build-impl.xml.script.CRC32=ff962246 +nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.104.0.48 diff --git a/Assignments/lab13_CalebFontenot/nbproject/project.properties b/Assignments/lab13_CalebFontenot/nbproject/project.properties new file mode 100644 index 0000000..9f2b709 --- /dev/null +++ b/Assignments/lab13_CalebFontenot/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}/lab13_CalebFontenot.jar +dist.javadoc.dir=${dist.dir}/javadoc +dist.jlink.dir=${dist.dir}/jlink +dist.jlink.output=${dist.jlink.dir}/lab13_CalebFontenot +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=1.8 +javac.target=1.8 +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=lab13_CalebFontenot +main.class=lab13_calebfontenot.Bug1 +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/Assignments/lab13_CalebFontenot/nbproject/project.xml b/Assignments/lab13_CalebFontenot/nbproject/project.xml new file mode 100644 index 0000000..e8aa2f9 --- /dev/null +++ b/Assignments/lab13_CalebFontenot/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + lab13_CalebFontenot + + + + + + + + + diff --git a/Assignments/lab13_CalebFontenot/src/lab13_calebfontenot/Bug1.java b/Assignments/lab13_CalebFontenot/src/lab13_calebfontenot/Bug1.java new file mode 100644 index 0000000..0548935 --- /dev/null +++ b/Assignments/lab13_CalebFontenot/src/lab13_calebfontenot/Bug1.java @@ -0,0 +1,14 @@ +package lab13_calebfontenot; + +public class Bug1 { + + public static void main(String[] args) + { + int count = 1; + while (count < 100) { + System.out.println("count: " + count); + count *= 2; + } + } + +} diff --git a/Assignments/lab13_CalebFontenot/src/lab13_calebfontenot/Bug2.java b/Assignments/lab13_CalebFontenot/src/lab13_calebfontenot/Bug2.java new file mode 100644 index 0000000..025be74 --- /dev/null +++ b/Assignments/lab13_CalebFontenot/src/lab13_calebfontenot/Bug2.java @@ -0,0 +1,54 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package lab13_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author ASDV2 + */ +public class Bug2 +{ + public static void main(String[] args) +{ + Scanner in = new Scanner(System.in); + int decimalNumber; + String binaryNumber; + System.out.print("Enter a positive integer: "); + decimalNumber = in.nextInt(); + int x = 0; + if (decimalNumber <= 0) + System.out.println("ERROR: entered integer is nonpositive."); + else { + binaryNumber = ""; + // algorithm step by step + // initial: binaryNumber = "", decimalNumber = 123 + // step 1 : binaryNumber = "1 ", decimalNumber = 61 + // step 2 : binaryNumber = "11 ", decimalNumber = 30 + // step 3 : binaryNumber = "011 ", decimalNumber = 15 + // step 4 : binaryNumber = "1011 ", decimalNumber = 7 + // step 5 : binaryNumber = "1 1011 ", decimalNumber = 3 + // step 6 : binaryNumber = "11 1011 ", decimalNumber = 1 + // step 6 : binaryNumber = "111 1011 ", decimalNumber = 0 + // stop : (decimalNumber != x) + + while (decimalNumber != x) + { + //> add spaces to separate 4-digit groups + if (binaryNumber.length() % 5 == 0) + binaryNumber = " " + binaryNumber; + //> extract last digit in binary representation + // and add it to binaryNumber + binaryNumber = (decimalNumber % 2) + binaryNumber; + //> cut last digit in binary representation + decimalNumber /= 2; + } + System.out.println("Binary: " + binaryNumber); + } + } + +} diff --git a/Exams/Exam2_CalebFontenot/Problem1.html b/Exams/Exam2_CalebFontenot/Problem1.html new file mode 100644 index 0000000..d39fbf1 --- /dev/null +++ b/Exams/Exam2_CalebFontenot/Problem1.html @@ -0,0 +1,72 @@ + + + +Problem1.java + + + + +
C:\Users\ar114\Documents\NetBeansProjects\Exam2_CalebFontenot\src\exam2_calebfontenot\Problem1.java
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package exam2_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author ar114
+ */
+public class Problem1 {
+
+    /**
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) {
+        // Define variables
+        double userInput = 0, average = 0;
+        int timesRun = 0;
+        
+        // Create scanner
+        Scanner input = new Scanner(System.in);
+        
+        System.out.println("I will calculate the average of numbers you will enter. \n");
+        
+        // While loop to grab inputs and calculate
+        while (userInput != -1) {
+            System.out.print("Enter a positive number, or type -1 to quit: ");
+            userInput = input.nextDouble();
+            
+            if (userInput != -1) {
+            // Calculate average
+            average += userInput;
+            // Increment timesRun
+            timesRun++;
+            }
+        }
+        average = average / (double) timesRun;
+        System.out.println("The average is: " + average);
+    }
+    
+}
+
+
+ diff --git a/Exams/Exam2_CalebFontenot/Problem2.html b/Exams/Exam2_CalebFontenot/Problem2.html new file mode 100644 index 0000000..40b54ef --- /dev/null +++ b/Exams/Exam2_CalebFontenot/Problem2.html @@ -0,0 +1,49 @@ + + + +Problem2.java + + + + +
C:\Users\ar114\Documents\NetBeansProjects\Exam2_CalebFontenot\src\exam2_calebfontenot\Problem2.java
+
+package exam2_calebfontenot;
+public class Problem2 {
+
+    public static void main(String[] args) {
+        int i = 1;
+        do {
+            int j = i;
+            while (j > 1) {
+                System.out.print("  ");
+                j--;
+            }
+            j = 1;
+            while (j <= 6 + 1 - i) {
+                j++;
+                if (i % 2 == 0) {
+                    continue;
+                }
+                System.out.print((j - 1) + " ");
+            
+            }
+            System.out.println();
+        i++;
+        } while ( i <= 6);
+    }
+}
+
+
+ diff --git a/Exams/Exam2_CalebFontenot/Problem3.html b/Exams/Exam2_CalebFontenot/Problem3.html new file mode 100644 index 0000000..355fe86 --- /dev/null +++ b/Exams/Exam2_CalebFontenot/Problem3.html @@ -0,0 +1,75 @@ + + + +Problem3.java + + + + +
C:\Users\ar114\Documents\NetBeansProjects\Exam2_CalebFontenot\src\exam2_calebfontenot\Problem3.java
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package exam2_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author ar114
+ */
+public class Problem3 {
+
+    public static void main(String[] args) {
+        // Create scanner
+        Scanner input = new Scanner(System.in);
+
+        // Define args
+        int currentPrime = 0, timesToIterate = 0, timesIncremented = 0;
+
+        while (timesToIterate != -1) {
+            System.out.print("         " + "===> -1 to quit or enter the number of primes you need generated and i will print 10 per line: ");
+            // Get amount of times the user wants us to iterate for.
+            timesToIterate = input.nextInt();
+            // Don't do anything if the input is -1
+            if (timesToIterate != -1) {
+                // First loop. This determines how many times to iterate.
+                for (int i = 0; i <= timesToIterate; i++) {
+                    currentPrime++;
+                    
+                    // It's broken somewhere here, but I'm not sure where exactly...
+                    // Generate primes by incrementing currentPrime and attempting to divide by itself.  
+                    for (int j = 1; j < timesIncremented; j++) {
+                        if (currentPrime % j == 0) {
+                            System.out.print(currentPrime + "  ");
+                        }
+                        timesIncremented++;
+                        // If we've incremented 10 times, print a new line.
+                        if (timesIncremented % 10 == 0) {
+                            System.out.println();
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+
+
+ diff --git a/Exams/Exam2_CalebFontenot/build.xml b/Exams/Exam2_CalebFontenot/build.xml new file mode 100644 index 0000000..cf8dc93 --- /dev/null +++ b/Exams/Exam2_CalebFontenot/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project Exam2_CalebFontenot. + + + diff --git a/Exams/Exam2_CalebFontenot/build/classes/.netbeans_automatic_build b/Exams/Exam2_CalebFontenot/build/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/Exams/Exam2_CalebFontenot/build/classes/.netbeans_update_resources b/Exams/Exam2_CalebFontenot/build/classes/.netbeans_update_resources new file mode 100644 index 0000000..e69de29 diff --git a/Exams/Exam2_CalebFontenot/build/classes/exam2_calebfontenot/Problem1.class b/Exams/Exam2_CalebFontenot/build/classes/exam2_calebfontenot/Problem1.class new file mode 100644 index 0000000..221c8bc Binary files /dev/null and b/Exams/Exam2_CalebFontenot/build/classes/exam2_calebfontenot/Problem1.class differ diff --git a/Exams/Exam2_CalebFontenot/build/classes/exam2_calebfontenot/Problem2.class b/Exams/Exam2_CalebFontenot/build/classes/exam2_calebfontenot/Problem2.class new file mode 100644 index 0000000..8e1ad94 Binary files /dev/null and b/Exams/Exam2_CalebFontenot/build/classes/exam2_calebfontenot/Problem2.class differ diff --git a/Exams/Exam2_CalebFontenot/build/classes/exam2_calebfontenot/Problem3.class b/Exams/Exam2_CalebFontenot/build/classes/exam2_calebfontenot/Problem3.class new file mode 100644 index 0000000..7b9dc5a Binary files /dev/null and b/Exams/Exam2_CalebFontenot/build/classes/exam2_calebfontenot/Problem3.class differ diff --git a/Exams/Exam2_CalebFontenot/manifest.mf b/Exams/Exam2_CalebFontenot/manifest.mf new file mode 100644 index 0000000..1574df4 --- /dev/null +++ b/Exams/Exam2_CalebFontenot/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/Exams/Exam2_CalebFontenot/nbproject/build-impl.xml b/Exams/Exam2_CalebFontenot/nbproject/build-impl.xml new file mode 100644 index 0000000..bd70cee --- /dev/null +++ b/Exams/Exam2_CalebFontenot/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/Exams/Exam2_CalebFontenot/nbproject/genfiles.properties b/Exams/Exam2_CalebFontenot/nbproject/genfiles.properties new file mode 100644 index 0000000..5540518 --- /dev/null +++ b/Exams/Exam2_CalebFontenot/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=a1961f55 +build.xml.script.CRC32=e222b254 +build.xml.stylesheet.CRC32=f85dc8f2@1.104.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=a1961f55 +nbproject/build-impl.xml.script.CRC32=57382989 +nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.104.0.48 diff --git a/Exams/Exam2_CalebFontenot/nbproject/private/private.properties b/Exams/Exam2_CalebFontenot/nbproject/private/private.properties new file mode 100644 index 0000000..d1134b6 --- /dev/null +++ b/Exams/Exam2_CalebFontenot/nbproject/private/private.properties @@ -0,0 +1,2 @@ +compile.on.save=true +user.properties.file=/home/caleb/.netbeans/15/build.properties diff --git a/Exams/Exam2_CalebFontenot/nbproject/private/private.xml b/Exams/Exam2_CalebFontenot/nbproject/private/private.xml new file mode 100644 index 0000000..c3112ac --- /dev/null +++ b/Exams/Exam2_CalebFontenot/nbproject/private/private.xml @@ -0,0 +1,9 @@ + + + + + + file:/home/caleb/ASDV-Java/Exams/Exam2_CalebFontenot/src/exam2_calebfontenot/Problem3.java + + + diff --git a/Exams/Exam2_CalebFontenot/nbproject/project.properties b/Exams/Exam2_CalebFontenot/nbproject/project.properties new file mode 100644 index 0000000..056ca67 --- /dev/null +++ b/Exams/Exam2_CalebFontenot/nbproject/project.properties @@ -0,0 +1,86 @@ +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}/Exam2_CalebFontenot.jar +dist.javadoc.dir=${dist.dir}/javadoc +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=1.8 +javac.target=1.8 +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.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=exam2_calebfontenot.Problem1 +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/Exams/Exam2_CalebFontenot/nbproject/project.xml b/Exams/Exam2_CalebFontenot/nbproject/project.xml new file mode 100644 index 0000000..24ea1c6 --- /dev/null +++ b/Exams/Exam2_CalebFontenot/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + Exam2_CalebFontenot + + + + + + + + + diff --git a/Exams/Exam2_CalebFontenot/src/exam2_calebfontenot/Problem1.java b/Exams/Exam2_CalebFontenot/src/exam2_calebfontenot/Problem1.java new file mode 100644 index 0000000..b6845e4 --- /dev/null +++ b/Exams/Exam2_CalebFontenot/src/exam2_calebfontenot/Problem1.java @@ -0,0 +1,45 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package exam2_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author ar114 + */ +public class Problem1 { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // Define variables + double userInput = 0, average = 0; + int timesRun = 0; + + // Create scanner + Scanner input = new Scanner(System.in); + + System.out.println("I will calculate the average of numbers you will enter. \n"); + + // While loop to grab inputs and calculate + while (userInput != -1) { + System.out.print("Enter a positive number, or type -1 to quit: "); + userInput = input.nextDouble(); + + if (userInput != -1) { + // Calculate average + average += userInput; + // Increment timesRun + timesRun++; + } + } + average = average / (double) timesRun; + System.out.println("The average is: " + average); + } + +} diff --git a/Exams/Exam2_CalebFontenot/src/exam2_calebfontenot/Problem2.java b/Exams/Exam2_CalebFontenot/src/exam2_calebfontenot/Problem2.java new file mode 100644 index 0000000..09354e6 --- /dev/null +++ b/Exams/Exam2_CalebFontenot/src/exam2_calebfontenot/Problem2.java @@ -0,0 +1,25 @@ +package exam2_calebfontenot; +public class Problem2 { + + public static void main(String[] args) { + int i = 1; + do { + int j = i; + while (j > 1) { + System.out.print(" "); + j--; + } + j = 1; + while (j <= 6 + 1 - i) { + j++; + if (i % 2 == 0) { + continue; + } + System.out.print((j - 1) + " "); + + } + System.out.println(); + i++; + } while ( i <= 6); + } +} diff --git a/Exams/Exam2_CalebFontenot/src/exam2_calebfontenot/Problem3.java b/Exams/Exam2_CalebFontenot/src/exam2_calebfontenot/Problem3.java new file mode 100644 index 0000000..38ace30 --- /dev/null +++ b/Exams/Exam2_CalebFontenot/src/exam2_calebfontenot/Problem3.java @@ -0,0 +1,53 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package exam2_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author ar114 + */ +public class Problem3 { + + public static void main(String[] args) { + // Create scanner + Scanner input = new Scanner(System.in); + + // Define args + int currentPrime = 0, timesToIterate = 0, timesIncremented = 0; + + while (timesToIterate != -1) { + System.out.print(" " + "===> -1 to quit or enter the number of primes you need generated and i will print 10 per line: "); + + // Get amount of times the user wants us to iterate for. + timesToIterate = input.nextInt(); + + // Don't do anything if the input is -1 + if (timesToIterate != -1) { + // First loop. This determines how many times to iterate. + for (int i = 0; i <= timesToIterate; i++) { + currentPrime++; + + // It's broken somewhere here, but I'm not sure where exactly... + // Generate primes by incrementing currentPrime and attempting to divide by itself. + for (int j = 1; j < timesIncremented; j++) { + if (currentPrime % j == 0) { + System.out.print(currentPrime + " "); + } + timesIncremented++; + // If we've incremented 10 times, print a new line. + if (timesIncremented % 10 == 0) { + System.out.println(); + } + } + + + } + } + } + } +} diff --git a/ZIPs/Exam2_CalebFontenot.zip b/ZIPs/Exam2_CalebFontenot.zip new file mode 100644 index 0000000..bfd869a Binary files /dev/null and b/ZIPs/Exam2_CalebFontenot.zip differ diff --git a/ZIPs/lab13_CalebFontenot.zip b/ZIPs/lab13_CalebFontenot.zip new file mode 100644 index 0000000..530fed3 Binary files /dev/null and b/ZIPs/lab13_CalebFontenot.zip differ