diff --git a/.gitignore b/.gitignore index d4b5f8a..2fc2a82 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ /Assignments/Lab10_CalebFontenot/build/ /Assignments/InClassOct6th/nbproject/private/ /Assignments/InClassOct6th/build/ +/Assignments/lab11_CalebFontenot/nbproject/private/ +/Assignments/lab11_CalebFontenot/build/ diff --git a/Assignments/lab11_CalebFontenot/DoWhile1.html b/Assignments/lab11_CalebFontenot/DoWhile1.html new file mode 100644 index 0000000..be8b6aa --- /dev/null +++ b/Assignments/lab11_CalebFontenot/DoWhile1.html @@ -0,0 +1,46 @@ + + + +DoWhile1.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhile1.java
+
+/*
+ * 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 lab11_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class DoWhile1 {
+    public static void main(String[] args) {
+        int i = 0;
+        do {
+            System.out.println(i);
+            i++;
+        }
+        while (i < 10);
+    }
+}
+
+
+ diff --git a/Assignments/lab11_CalebFontenot/DoWhile2.html b/Assignments/lab11_CalebFontenot/DoWhile2.html new file mode 100644 index 0000000..a1eaa1c --- /dev/null +++ b/Assignments/lab11_CalebFontenot/DoWhile2.html @@ -0,0 +1,54 @@ + + + +DoWhile2.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhile2.java
+
+/*
+ * 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 lab11_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class DoWhile2 {
+    public static void main(String[] args) {
+        int i = 1;
+        do {
+            
+            System.out.print(i + ", ");
+            
+            // if number is divisable by 10, delete the last two characters and print a new line.
+            if (i % 10 == 0) {
+                System.out.print("\b\b\n");
+            }
+            i++;
+            
+        }
+        while (i <= 100);
+    }
+}
+
+
+ diff --git a/Assignments/lab11_CalebFontenot/DoWhileEvent1.html b/Assignments/lab11_CalebFontenot/DoWhileEvent1.html new file mode 100644 index 0000000..fe0a01b --- /dev/null +++ b/Assignments/lab11_CalebFontenot/DoWhileEvent1.html @@ -0,0 +1,52 @@ + + + +DoWhileEvent1.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhileEvent1.java
+
+/*
+ * 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 lab11_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author caleb
+ */
+public class DoWhileEvent1 {
+    public static void main(String[] args) {
+        Scanner scan = new Scanner(System.in);
+        int num = 0;
+        int sum = 0;
+        do {
+            System.out.print("Please enter a positive number to add it to the sum or -1 to quit: ");
+            num = scan.nextInt();
+            sum = num != -1 ? sum + num : sum;
+        } while (num != -1);
+        System.out.println("Total : " + sum);
+    }
+}
+
+
+ diff --git a/Assignments/lab11_CalebFontenot/DoWhileEvent2.html b/Assignments/lab11_CalebFontenot/DoWhileEvent2.html new file mode 100644 index 0000000..5736185 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/DoWhileEvent2.html @@ -0,0 +1,55 @@ + + + +DoWhileEvent2.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhileEvent2.java
+
+/*
+ * 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 lab11_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author caleb
+ */
+public class DoWhileEvent2 {
+    public static void main(String[] args) {
+        System.out.println("Please enter a positive number to add it to sum or -1 to quit");
+        Scanner scan = new Scanner(System.in);
+        int num = scan.nextInt(); //2 Condition: initialize the condition of the loop
+        int sum = 0; //1 task: Initialize the task
+        do //1 condition: What is the condition?
+        {
+            sum += num; //2 task: task of the loop and its update
+            System.out.println("Please enter a positive number to add it to sum or -1 to quit");
+            num = scan.nextInt();//3 condition update the condition of the loop.
+        }
+        while (num != -1);
+        System.out.println("Total " + sum);
+    }
+}
+
+
+ diff --git a/Assignments/lab11_CalebFontenot/DoWhileEvent3.html b/Assignments/lab11_CalebFontenot/DoWhileEvent3.html new file mode 100644 index 0000000..ad62020 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/DoWhileEvent3.html @@ -0,0 +1,70 @@ + + + +DoWhileEvent3.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhileEvent3.java
+
+/*
+ * 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 lab11_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author caleb
+ */
+public class DoWhileEvent3 {
+
+    public static void main(String[] args) {
+        // Define variables
+        int sum = 0, numInt = 0;
+        String num = "This can be literally anything, it just needs to be initialized";
+
+        // Create scanner
+        Scanner input = new Scanner(System.in);
+
+        do {
+            System.out.print("Enter an integer to add to the sum (type x to exit): ");
+            num = input.nextLine();                             //Read input from console
+            try {
+                numInt = Integer.parseInt(num);                 // Parse input as integer
+                } catch (Exception NumberFormatException) {     // Catch invalid inputs
+                    if (num.toLowerCase().equals("x")) {
+                        break;
+                    } else;
+                System.out.println("Invalid input!");
+            }
+            sum += numInt;                                     // add integer to the sum
+
+            System.out.println("Current sum: " + sum);
+        } while (!(num.toLowerCase().equals("x")));
+        System.out.println("Exited loop!");
+        System.out.println("Final sum: " + sum);
+
+    }
+}
+
+
+ diff --git a/Assignments/lab11_CalebFontenot/For1.html b/Assignments/lab11_CalebFontenot/For1.html new file mode 100644 index 0000000..27bd1bc --- /dev/null +++ b/Assignments/lab11_CalebFontenot/For1.html @@ -0,0 +1,44 @@ + + + +For1.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/For1.java
+
+/*
+ * 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 lab11_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class For1 {
+    public static void main(String[] args) {
+        for (int i=0; i < 10; ++i) {
+            System.out.println(i);
+        }
+            
+    }
+}
+
+
+ diff --git a/Assignments/lab11_CalebFontenot/For2.html b/Assignments/lab11_CalebFontenot/For2.html new file mode 100644 index 0000000..f2a5265 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/For2.html @@ -0,0 +1,46 @@ + + + +For2.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/For2.java
+
+/*
+ * 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 lab11_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class For2 {
+    public static void main(String[] args) {
+        for (int i=10; i < 20; ++i) {
+            System.out.println("Square Root of " + i + ": " + Math.sqrt(i));
+        }
+            
+    }
+}
+
+
+ diff --git a/Assignments/lab11_CalebFontenot/While1.html b/Assignments/lab11_CalebFontenot/While1.html new file mode 100644 index 0000000..cc3241f --- /dev/null +++ b/Assignments/lab11_CalebFontenot/While1.html @@ -0,0 +1,46 @@ + + + +While1.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/While1.java
+
+/*
+ * 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 lab11_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class While1 {
+    public static void main(String[] args) {
+        int i = 0;
+        while (i < 10)
+        {
+            System.out.println(i);
+            ++i;
+        }
+    }
+}
+
+
+ diff --git a/Assignments/lab11_CalebFontenot/While2.html b/Assignments/lab11_CalebFontenot/While2.html new file mode 100644 index 0000000..4bee5b5 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/While2.html @@ -0,0 +1,43 @@ + + + +While2.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/While2.java
+
+/*
+ * 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 lab11_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class While2 {
+    public static void main(String[] args) {
+        int i = 0;
+        while (i < 10)
+            System.out.println(i++);
+    }
+}
+
+
+ diff --git a/Assignments/lab11_CalebFontenot/While3.html b/Assignments/lab11_CalebFontenot/While3.html new file mode 100644 index 0000000..8d9512c --- /dev/null +++ b/Assignments/lab11_CalebFontenot/While3.html @@ -0,0 +1,43 @@ + + + +While3.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/While3.java
+
+/*
+ * 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 lab11_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class While3 {
+    public static void main(String[] args) {
+        int i = 10;
+        while (i > -1)
+            System.out.println(i--);
+    }
+}
+
+
+ diff --git a/Assignments/lab11_CalebFontenot/WhileEvent1.html b/Assignments/lab11_CalebFontenot/WhileEvent1.html new file mode 100644 index 0000000..fe19954 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/WhileEvent1.html @@ -0,0 +1,55 @@ + + + +WhileEvent1.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/WhileEvent1.java
+
+/*
+ * 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 lab11_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author caleb
+ */
+public class WhileEvent1 {
+    public static void main(String[] args) {
+        System.out.println("Please enter a positive number to add it to sum or -1 to quit");
+        Scanner scan = new Scanner(System.in);
+        int num = scan.nextInt(); //2 Condition: initialize the condition of the loop
+        int sum = 0; //1 task: Initialize the task
+        while (num != -1) //1 condition: What is the condition?
+        {
+            sum += num; //2 task: task of the loop and its update
+            System.out.println("Please enter a positive number to add it to sum or -1 to quit");
+            num = scan.nextInt();//3 condition update the condition of the loop.
+        }
+        
+        System.out.println("Total " + sum);
+    }
+}
+
+
+ diff --git a/Assignments/lab11_CalebFontenot/WhileEvent3.html b/Assignments/lab11_CalebFontenot/WhileEvent3.html new file mode 100644 index 0000000..c555cf8 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/WhileEvent3.html @@ -0,0 +1,70 @@ + + + +WhileEvent3.java + + + + +
/home/caleb/ASDV-Java/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/WhileEvent3.java
+
+/*
+ * 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 lab11_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author caleb
+ */
+public class WhileEvent3 {
+
+    public static void main(String[] args) {
+        // Define variables
+        int sum = 0, numInt = 0;
+        String num = "This can be literally anything, it just needs to be initialized";
+
+        // Create scanner
+        Scanner input = new Scanner(System.in);
+
+        while (!(num.toLowerCase().equals("x"))) {
+            System.out.print("Enter an integer to add to the sum (type x to exit): ");
+            num = input.nextLine();                             //Read input from console
+            try {
+                numInt = Integer.parseInt(num);                 // Parse input as integer
+                } catch (Exception NumberFormatException) {     // Catch invalid inputs
+                    if (num.toLowerCase().equals("x")) {
+                        break;
+                    } else;
+                System.out.println("Invalid input!");
+            }
+            sum += numInt;                                     // add integer to the sum
+
+            System.out.println("Current sum: " + sum);
+        }
+        System.out.println("Exited loop!");
+        System.out.println("Final sum: " + sum);
+
+    }
+}
+
+
+ diff --git a/Assignments/lab11_CalebFontenot/build.xml b/Assignments/lab11_CalebFontenot/build.xml new file mode 100644 index 0000000..d8dcbc0 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project lab11_CalebFontenot. + + + diff --git a/Assignments/lab11-1.pdf b/Assignments/lab11_CalebFontenot/lab11-1.pdf similarity index 100% rename from Assignments/lab11-1.pdf rename to Assignments/lab11_CalebFontenot/lab11-1.pdf diff --git a/Assignments/lab11_CalebFontenot/manifest.mf b/Assignments/lab11_CalebFontenot/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/Assignments/lab11_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/lab11_CalebFontenot/nbproject/build-impl.xml b/Assignments/lab11_CalebFontenot/nbproject/build-impl.xml new file mode 100644 index 0000000..c03fbba --- /dev/null +++ b/Assignments/lab11_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/lab11_CalebFontenot/nbproject/genfiles.properties b/Assignments/lab11_CalebFontenot/nbproject/genfiles.properties new file mode 100644 index 0000000..aa5893e --- /dev/null +++ b/Assignments/lab11_CalebFontenot/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=9e8c47b8 +build.xml.script.CRC32=9b03d5fc +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=9e8c47b8 +nbproject/build-impl.xml.script.CRC32=81e4946a +nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.104.0.48 diff --git a/Assignments/lab11_CalebFontenot/nbproject/project.properties b/Assignments/lab11_CalebFontenot/nbproject/project.properties new file mode 100644 index 0000000..7ef3085 --- /dev/null +++ b/Assignments/lab11_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}/lab11_CalebFontenot.jar +dist.javadoc.dir=${dist.dir}/javadoc +dist.jlink.dir=${dist.dir}/jlink +dist.jlink.output=${dist.jlink.dir}/lab11_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=19 +javac.target=19 +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=lab11_CalebFontenot +main.class=lab11_calebfontenot.Lab11_CalebFontenot +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/lab11_CalebFontenot/nbproject/project.xml b/Assignments/lab11_CalebFontenot/nbproject/project.xml new file mode 100644 index 0000000..d19feaa --- /dev/null +++ b/Assignments/lab11_CalebFontenot/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + lab11_CalebFontenot + + + + + + + + + diff --git a/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhile1.java b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhile1.java new file mode 100644 index 0000000..eba864c --- /dev/null +++ b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhile1.java @@ -0,0 +1,20 @@ +/* + * 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 lab11_calebfontenot; + +/** + * + * @author caleb + */ +public class DoWhile1 { + public static void main(String[] args) { + int i = 0; + do { + System.out.println(i); + i++; + } + while (i < 10); + } +} diff --git a/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhile2.java b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhile2.java new file mode 100644 index 0000000..88236bc --- /dev/null +++ b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhile2.java @@ -0,0 +1,27 @@ +/* + * 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 lab11_calebfontenot; + +/** + * + * @author caleb + */ +public class DoWhile2 { + public static void main(String[] args) { + int i = 1; + do { + + System.out.print(i + ", "); + + // if number is divisable by 10, delete the last two characters and print a new line. + if (i % 10 == 0) { + System.out.print("\b\b\n"); + } + i++; + + } + while (i <= 100); + } +} diff --git a/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhileEvent1.java b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhileEvent1.java new file mode 100644 index 0000000..ef07ffd --- /dev/null +++ b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhileEvent1.java @@ -0,0 +1,25 @@ +/* + * 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 lab11_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author caleb + */ +public class DoWhileEvent1 { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int num = 0; + int sum = 0; + do { + System.out.print("Please enter a positive number to add it to the sum or -1 to quit: "); + num = scan.nextInt(); + sum = num != -1 ? sum + num : sum; + } while (num != -1); + System.out.println("Total : " + sum); + } +} diff --git a/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhileEvent2.java b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhileEvent2.java new file mode 100644 index 0000000..78dca3c --- /dev/null +++ b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhileEvent2.java @@ -0,0 +1,28 @@ +/* + * 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 lab11_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author caleb + */ +public class DoWhileEvent2 { + public static void main(String[] args) { + System.out.println("Please enter a positive number to add it to sum or -1 to quit"); + Scanner scan = new Scanner(System.in); + int num = scan.nextInt(); //2 Condition: initialize the condition of the loop + int sum = 0; //1 task: Initialize the task + do //1 condition: What is the condition? + { + sum += num; //2 task: task of the loop and its update + System.out.println("Please enter a positive number to add it to sum or -1 to quit"); + num = scan.nextInt();//3 condition update the condition of the loop. + } + while (num != -1); + System.out.println("Total " + sum); + } +} diff --git a/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhileEvent3.java b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhileEvent3.java new file mode 100644 index 0000000..9b98bfd --- /dev/null +++ b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/DoWhileEvent3.java @@ -0,0 +1,42 @@ +/* + * 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 lab11_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author caleb + */ +public class DoWhileEvent3 { + + public static void main(String[] args) { + // Define variables + int sum = 0, numInt = 0; + String num = "This can be literally anything, it just needs to be initialized"; + + // Create scanner + Scanner input = new Scanner(System.in); + + do { + System.out.print("Enter an integer to add to the sum (type x to exit): "); + num = input.nextLine(); //Read input from console + try { + numInt = Integer.parseInt(num); // Parse input as integer + } catch (Exception NumberFormatException) { // Catch invalid inputs + if (num.toLowerCase().equals("x")) { + break; + } else; + System.out.println("Invalid input!"); + } + sum += numInt; // add integer to the sum + + System.out.println("Current sum: " + sum); + } while (!(num.toLowerCase().equals("x"))); + System.out.println("Exited loop!"); + System.out.println("Final sum: " + sum); + + } +} diff --git a/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/For1.java b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/For1.java new file mode 100644 index 0000000..f99544a --- /dev/null +++ b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/For1.java @@ -0,0 +1,18 @@ +/* + * 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 lab11_calebfontenot; + +/** + * + * @author caleb + */ +public class For1 { + public static void main(String[] args) { + for (int i=0; i < 10; ++i) { + System.out.println(i); + } + + } +} diff --git a/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/For2.java b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/For2.java new file mode 100644 index 0000000..13d6885 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/For2.java @@ -0,0 +1,18 @@ +/* + * 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 lab11_calebfontenot; + +/** + * + * @author caleb + */ +public class For2 { + public static void main(String[] args) { + for (int i=10; i < 20; ++i) { + System.out.println("Square Root of " + i + ": " + Math.sqrt(i)); + } + + } +} diff --git a/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/Lab11_CalebFontenot.java b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/Lab11_CalebFontenot.java new file mode 100644 index 0000000..704c197 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/Lab11_CalebFontenot.java @@ -0,0 +1,20 @@ +/* + * 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 lab11_calebfontenot; + +/** + * + * @author caleb + */ +public class Lab11_CalebFontenot { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + System.out.println("\uDD14"); + } + +} diff --git a/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/While1.java b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/While1.java new file mode 100644 index 0000000..02000d3 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/While1.java @@ -0,0 +1,20 @@ +/* + * 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 lab11_calebfontenot; + +/** + * + * @author caleb + */ +public class While1 { + public static void main(String[] args) { + int i = 0; + while (i < 10) + { + System.out.println(i); + ++i; + } + } +} diff --git a/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/While2.java b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/While2.java new file mode 100644 index 0000000..664b474 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/While2.java @@ -0,0 +1,17 @@ +/* + * 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 lab11_calebfontenot; + +/** + * + * @author caleb + */ +public class While2 { + public static void main(String[] args) { + int i = 0; + while (i < 10) + System.out.println(i++); + } +} diff --git a/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/While3.java b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/While3.java new file mode 100644 index 0000000..b67b3a1 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/While3.java @@ -0,0 +1,17 @@ +/* + * 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 lab11_calebfontenot; + +/** + * + * @author caleb + */ +public class While3 { + public static void main(String[] args) { + int i = 10; + while (i > -1) + System.out.println(i--); + } +} diff --git a/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/WhileEvent1.java b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/WhileEvent1.java new file mode 100644 index 0000000..9ae1cd2 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/WhileEvent1.java @@ -0,0 +1,28 @@ +/* + * 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 lab11_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author caleb + */ +public class WhileEvent1 { + public static void main(String[] args) { + System.out.println("Please enter a positive number to add it to sum or -1 to quit"); + Scanner scan = new Scanner(System.in); + int num = scan.nextInt(); //2 Condition: initialize the condition of the loop + int sum = 0; //1 task: Initialize the task + while (num != -1) //1 condition: What is the condition? + { + sum += num; //2 task: task of the loop and its update + System.out.println("Please enter a positive number to add it to sum or -1 to quit"); + num = scan.nextInt();//3 condition update the condition of the loop. + } + + System.out.println("Total " + sum); + } +} diff --git a/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/WhileEvent3.java b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/WhileEvent3.java new file mode 100644 index 0000000..2b71633 --- /dev/null +++ b/Assignments/lab11_CalebFontenot/src/lab11_calebfontenot/WhileEvent3.java @@ -0,0 +1,42 @@ +/* + * 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 lab11_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author caleb + */ +public class WhileEvent3 { + + public static void main(String[] args) { + // Define variables + int sum = 0, numInt = 0; + String num = "This can be literally anything, it just needs to be initialized"; + + // Create scanner + Scanner input = new Scanner(System.in); + + while (!(num.toLowerCase().equals("x"))) { + System.out.print("Enter an integer to add to the sum (type x to exit): "); + num = input.nextLine(); //Read input from console + try { + numInt = Integer.parseInt(num); // Parse input as integer + } catch (Exception NumberFormatException) { // Catch invalid inputs + if (num.toLowerCase().equals("x")) { + break; + } else; + System.out.println("Invalid input!"); + } + sum += numInt; // add integer to the sum + + System.out.println("Current sum: " + sum); + } + System.out.println("Exited loop!"); + System.out.println("Final sum: " + sum); + + } +} diff --git a/ZIPs/lab11_CalebFontenot.zip b/ZIPs/lab11_CalebFontenot.zip new file mode 100644 index 0000000..e8ac8db Binary files /dev/null and b/ZIPs/lab11_CalebFontenot.zip differ