diff --git a/Assignments/lab14_CalebFontenot/PrimeNumbers.html b/Assignments/lab14_CalebFontenot/PrimeNumbers.html
new file mode 100644
index 0000000..653640d
--- /dev/null
+++ b/Assignments/lab14_CalebFontenot/PrimeNumbers.html
@@ -0,0 +1,76 @@
+
+
+
+PrimeNumbers.java
+
+
+
+
+/home/caleb/ASDV-Java/Assignments/lab14_CalebFontenot/src/lab14_calebfontenot/PrimeNumbers.java |
+
+
+nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
+nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
+
+package lab14_calebfontenot;
+
+
+
+
+
+public class PrimeNumbers {
+ public static void main(String[] args)
+ {
+ System.out.println("The first 50 prime numbers are: \n");
+ printPrimeNumbers(50);
+ }
+ public static void printPrimeNumbers(int numberOfPrimes) {
+ final int NUMBER_OF_PRIMES_PER_LINE = 10;
+ int count = 0;
+ int number = 1;
+
+
+ while (count < numberOfPrimes) {
+
+ if (isPrime(number)) {
+ count++;
+ if (count % NUMBER_OF_PRIMES_PER_LINE == 0) {
+
+ System.out.printf("%-5d\n", number);
+ }
+ else {
+ System.out.printf("%-5d", number);
+ }
+ }
+
+ number++;
+ }
+ }
+ public static boolean isPrime(int number) {
+ for (int divisor = 2; divisor <= number / 2; divisor++) {
+ if (number % divisor == 0) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+}
+
+
+
diff --git a/Assignments/lab14_CalebFontenot/StaticMethods.html b/Assignments/lab14_CalebFontenot/StaticMethods.html
new file mode 100644
index 0000000..47cb612
--- /dev/null
+++ b/Assignments/lab14_CalebFontenot/StaticMethods.html
@@ -0,0 +1,153 @@
+
+
+
+StaticMethods.java
+
+
+
+
+/home/caleb/ASDV-Java/Assignments/lab14_CalebFontenot/src/lab14_calebfontenot/StaticMethods.java |
+
+
+nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
+nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
+
+package lab14_calebfontenot;
+
+import java.util.Scanner;
+
+
+
+
+
+public class StaticMethods {
+ static int executeCount = 0;
+ public static void main(String[] args)
+ {
+ StaticMethods.printJava();
+ for (int i = 0; i < 20; i++) {
+ for (int y = 0; y < 5; y++) {
+ StaticMethods.printMyName();
+ }
+ System.out.println();
+ }
+ executeCount = 0;
+ for (int i = 0; i < 50; i++) {
+ for (int y = 0; y < 2; y++) {
+ StaticMethods.printMessage("Java is fun!");
+ }
+ System.out.println();
+ }
+
+ System.out.println(StaticMethods.squareNumber(5));
+ System.out.println(StaticMethods.squareNumber(5.0));
+ System.out.println(StaticMethods.cubeNumber(5));
+ System.out.println(StaticMethods.cubeNumber(5.0));
+ System.out.println(StaticMethods.menu());
+
+
+ char menuReturn = StaticMethods.menu();
+ if (menuReturn == 'c') {
+ System.out.println(StaticMethods.cubeNumber(5));
+ System.out.println(StaticMethods.cubeNumber(5.0));
+ } else if (menuReturn == 's') {
+ System.out.println(StaticMethods.squareNumber(5));
+ System.out.println(StaticMethods.squareNumber(5.0));
+ }
+
+ System.out.println(StaticMethods.menuInteger());
+
+
+ Scanner input = new Scanner(System.in);
+ System.out.print("Enter the number of sides: ");
+ int n = input.nextInt();
+ System.out.print("Enter the side: ");
+ double side = input.nextDouble();
+
+ System.out.println("The area of the polygon is: " + StaticMethods.area(n, side));
+
+ }
+ public static void printJava() {
+ System.out.println("Java");
+ }
+ public static void printMyName() {
+ System.out.print("Caleb Fontenot ");
+ System.out.print(++executeCount + " ");
+ }
+ public static void printMessage(String msg) {
+ System.out.print(msg + " ");
+ System.out.print(++executeCount + " ");
+ }
+ public static int squareNumber(int number) {
+ System.out.println("INT (squre) was called");
+ return number * number;
+ }
+ public static double squareNumber(double number) {
+ System.out.println("DOUBLE (square) was called");
+ return number * number;
+ }
+ public static int cubeNumber(int number) {
+ System.out.println("INT (cube) was called");
+ return number * StaticMethods.squareNumber(number);
+ }
+ public static double cubeNumber(double number) {
+ System.out.println("DOUBLE (cube) was called");
+ return number * StaticMethods.squareNumber(number);
+ }
+ public static char menu() {
+ String s = "";
+ do {
+ System.out.println("type S\\s to square a number");
+ System.out.println("type C\\c to cube a number");
+ System.out.print("Input: ");
+ s = new Scanner(System.in).next();
+ if ("c".compareToIgnoreCase(s) != 0 && "s".compareToIgnoreCase(s) != 0) {
+ System.out.println("\tplease enter a valid character");
+ }
+ } while ("c".compareToIgnoreCase(s) != 0 && "s".compareToIgnoreCase(s) != 0);
+ return s.toLowerCase().charAt(0);
+ }
+ public static int menuInteger() {
+ Scanner input = new Scanner(System.in);
+ int returnInt = -1;
+ while (true) {
+ System.out.print("Enter an integer (must be 1000, 2000, or 3000): ");
+ returnInt = input.nextInt();
+ if (returnInt == 1000){
+ return returnInt;
+ }
+ else if (returnInt == 2000) {
+ return returnInt;
+ }
+ else if (returnInt == 3000) {
+ return returnInt;
+ }
+ else {
+ System.out.println("Integer not allowed, try again");
+ }
+ }
+
+ }
+ public static double area(int n, double side) {
+
+ return (n * Math.pow(side, 2)) / (4.0 * Math.tan(Math.PI / n));
+ }
+}
+
+
+
diff --git a/Assignments/lab14_CalebFontenot/src/lab14_calebfontenot/StaticMethods.java b/Assignments/lab14_CalebFontenot/src/lab14_calebfontenot/StaticMethods.java
index 72950a5..3a5ef45 100644
--- a/Assignments/lab14_CalebFontenot/src/lab14_calebfontenot/StaticMethods.java
+++ b/Assignments/lab14_CalebFontenot/src/lab14_calebfontenot/StaticMethods.java
@@ -28,14 +28,14 @@ public class StaticMethods {
}
System.out.println();
}
- /*
+
System.out.println(StaticMethods.squareNumber(5));
System.out.println(StaticMethods.squareNumber(5.0));
System.out.println(StaticMethods.cubeNumber(5));
System.out.println(StaticMethods.cubeNumber(5.0));
- //System.out.println(StaticMethods.menu());
- */
- /*
+ System.out.println(StaticMethods.menu());
+
+
char menuReturn = StaticMethods.menu();
if (menuReturn == 'c') {
System.out.println(StaticMethods.cubeNumber(5));
@@ -46,7 +46,6 @@ public class StaticMethods {
}
System.out.println(StaticMethods.menuInteger());
-*/
// Area
Scanner input = new Scanner(System.in);
diff --git a/Test Project/src/main/java/com/mycompany/mavenproject1/BitwiseOR.java b/Test Project/src/main/java/com/mycompany/mavenproject1/BitwiseOR.java
new file mode 100644
index 0000000..fcf63dc
--- /dev/null
+++ b/Test Project/src/main/java/com/mycompany/mavenproject1/BitwiseOR.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 com.mycompany.mavenproject1;
+
+/**
+ *
+ * @author caleb
+ */
+public class BitwiseOR {
+
+ public static void main(String[] args) {
+ int x = 1;
+ int y = 5;
+ while (y-- > 0 ^ x++ < 100);
+ System.out.println(++x);
+
+ }
+}
diff --git a/Test Project/src/main/java/com/mycompany/mavenproject1/ByteOverFlow.java b/Test Project/src/main/java/com/mycompany/mavenproject1/ByteOverFlow.java
index 3fcc13d..75a6f53 100644
--- a/Test Project/src/main/java/com/mycompany/mavenproject1/ByteOverFlow.java
+++ b/Test Project/src/main/java/com/mycompany/mavenproject1/ByteOverFlow.java
@@ -13,6 +13,6 @@ public class ByteOverFlow {
{
byte b = 127;
b++;
- System.out.println(b);
+ System.out.println(b)Íž
}
}
diff --git a/Test Project/src/main/java/com/mycompany/mavenproject1/Loop12.java b/Test Project/src/main/java/com/mycompany/mavenproject1/Loop12.java
index d1559d6..bedcda8 100644
--- a/Test Project/src/main/java/com/mycompany/mavenproject1/Loop12.java
+++ b/Test Project/src/main/java/com/mycompany/mavenproject1/Loop12.java
@@ -9,11 +9,14 @@ package com.mycompany.mavenproject1;
* @author caleb
*/
public class Loop12 {
- public static void main(String[] args)
- {
- for (int i = 0; i < 6; i++)
- for (int j = 0; j < i; j += 2)
- System.out.println("java");
+
+ public static void main(String[] args) {
+ int lol = 0;
+ for (int i = 0; i < 6; i++) {
+ for (int j = 0; j < i; j += 2) {
+ System.out.println("java" + ++lol);
+ }
+ }
}
}
diff --git a/Test Project/src/main/java/com/mycompany/mavenproject1/MathRounding.java b/Test Project/src/main/java/com/mycompany/mavenproject1/MathRounding.java
new file mode 100644
index 0000000..9d3e02a
--- /dev/null
+++ b/Test Project/src/main/java/com/mycompany/mavenproject1/MathRounding.java
@@ -0,0 +1,34 @@
+/*
+ * 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.mycompany.mavenproject1;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author caleb
+ */
+public class MathRounding {
+ public static void main(String[] args) {
+ Scanner scan = new Scanner(System.in);
+
+ double toRound = 1;
+
+ while (toRound != 0)
+ {
+ System.out.println("Time to find out what this shit does: (hit 0 to fuck off) ");
+ toRound = scan.nextDouble();
+
+ if (toRound == 0)
+ break;
+
+ System.out.println("Math.rint gives you " + Math.rint(toRound));
+ System.out.println("Math.ceil gives you " + Math.ceil(toRound));
+ System.out.println("Math.round gives you " + Math.round(toRound));
+ System.out.println("Math.floor gives you " + Math.floor(toRound));
+ }
+ System.out.println("Goodbye!");
+ }
+}
diff --git a/Test Project/src/main/java/com/mycompany/mavenproject1/NegativeChar.java b/Test Project/src/main/java/com/mycompany/mavenproject1/NegativeChar.java
new file mode 100644
index 0000000..b955dfd
--- /dev/null
+++ b/Test Project/src/main/java/com/mycompany/mavenproject1/NegativeChar.java
@@ -0,0 +1,16 @@
+/*
+ * 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.mycompany.mavenproject1;
+
+/**
+ *
+ * @author caleb
+ */
+public class NegativeChar {
+ public static void main(String[] args) {
+ char lolChar = '\5';
+ System.out.println(lolChar);
+ }
+}
diff --git a/Test Project/src/main/java/com/mycompany/mavenproject1/Q20.java b/Test Project/src/main/java/com/mycompany/mavenproject1/Q20.java
new file mode 100644
index 0000000..942d113
--- /dev/null
+++ b/Test Project/src/main/java/com/mycompany/mavenproject1/Q20.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 com.mycompany.mavenproject1;
+
+/**
+ *
+ * @author caleb
+ */
+public class Q20 {
+ public static void main(String[] args) {
+ int x = 0;
+ int y = 10;
+ while ( -x > -5)
+ {
+ while ( y % 5 == 0 )
+ {
+
+ y -= 5;
+ if ( y < 0 )
+ break;
+ }
+ x++;
+ }
+ System.out.println(x+y);
+ }
+}
diff --git a/Test Project/src/main/java/com/mycompany/mavenproject1/Rint.java b/Test Project/src/main/java/com/mycompany/mavenproject1/Rint.java
new file mode 100644
index 0000000..3ccf1a4
--- /dev/null
+++ b/Test Project/src/main/java/com/mycompany/mavenproject1/Rint.java
@@ -0,0 +1,16 @@
+/*
+ * 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.mycompany.mavenproject1;
+
+/**
+ *
+ * @author caleb
+ */
+public class Rint {
+ public static void main(String[] args) {
+ System.out.println( Math.rint(5.5) );
+System.out.println( Math.rint(4.5) );
+ }
+}
diff --git a/Test Project/src/main/java/com/mycompany/mavenproject1/WeirdCharStuff.java b/Test Project/src/main/java/com/mycompany/mavenproject1/WeirdCharStuff.java
new file mode 100644
index 0000000..0f5e975
--- /dev/null
+++ b/Test Project/src/main/java/com/mycompany/mavenproject1/WeirdCharStuff.java
@@ -0,0 +1,16 @@
+/*
+ * 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.mycompany.mavenproject1;
+
+/**
+ *
+ * @author caleb
+ */
+public class WeirdCharStuff {
+ public static void main(String[] args) {
+ char c = '2' + 2;
+ System.out.println((int) c + 4);
+ }
+}
diff --git a/Test Project/target/classes/.netbeans_automatic_build b/Test Project/target/classes/.netbeans_automatic_build
deleted file mode 100644
index e69de29..0000000
diff --git a/Test Project/target/classes/com/mycompany/mavenproject1/BitwiseOR.class b/Test Project/target/classes/com/mycompany/mavenproject1/BitwiseOR.class
new file mode 100644
index 0000000..90e1fe2
Binary files /dev/null and b/Test Project/target/classes/com/mycompany/mavenproject1/BitwiseOR.class differ
diff --git a/Test Project/target/classes/com/mycompany/mavenproject1/ByteOverFlow.class b/Test Project/target/classes/com/mycompany/mavenproject1/ByteOverFlow.class
index 221fb7d..8393419 100644
Binary files a/Test Project/target/classes/com/mycompany/mavenproject1/ByteOverFlow.class and b/Test Project/target/classes/com/mycompany/mavenproject1/ByteOverFlow.class differ
diff --git a/Test Project/target/classes/com/mycompany/mavenproject1/Loop12.class b/Test Project/target/classes/com/mycompany/mavenproject1/Loop12.class
index d312c6a..a8e2338 100644
Binary files a/Test Project/target/classes/com/mycompany/mavenproject1/Loop12.class and b/Test Project/target/classes/com/mycompany/mavenproject1/Loop12.class differ
diff --git a/Test Project/target/classes/com/mycompany/mavenproject1/MathRounding.class b/Test Project/target/classes/com/mycompany/mavenproject1/MathRounding.class
new file mode 100644
index 0000000..ad797d8
Binary files /dev/null and b/Test Project/target/classes/com/mycompany/mavenproject1/MathRounding.class differ
diff --git a/Test Project/target/classes/com/mycompany/mavenproject1/NegativeChar.class b/Test Project/target/classes/com/mycompany/mavenproject1/NegativeChar.class
new file mode 100644
index 0000000..22e186a
Binary files /dev/null and b/Test Project/target/classes/com/mycompany/mavenproject1/NegativeChar.class differ
diff --git a/Test Project/target/classes/com/mycompany/mavenproject1/Q20.class b/Test Project/target/classes/com/mycompany/mavenproject1/Q20.class
new file mode 100644
index 0000000..0472759
Binary files /dev/null and b/Test Project/target/classes/com/mycompany/mavenproject1/Q20.class differ
diff --git a/Test Project/target/classes/com/mycompany/mavenproject1/Rint.class b/Test Project/target/classes/com/mycompany/mavenproject1/Rint.class
new file mode 100644
index 0000000..f1eafb1
Binary files /dev/null and b/Test Project/target/classes/com/mycompany/mavenproject1/Rint.class differ
diff --git a/Test Project/target/classes/com/mycompany/mavenproject1/WeirdCharStuff.class b/Test Project/target/classes/com/mycompany/mavenproject1/WeirdCharStuff.class
new file mode 100644
index 0000000..ad53f86
Binary files /dev/null and b/Test Project/target/classes/com/mycompany/mavenproject1/WeirdCharStuff.class differ
diff --git a/Test Project/target/test-classes/.netbeans_automatic_build b/Test Project/target/test-classes/.netbeans_automatic_build
deleted file mode 100644
index e69de29..0000000
diff --git a/ZIPs/lab14_CalebFontenot.zip b/ZIPs/lab14_CalebFontenot.zip
new file mode 100644
index 0000000..a66f93c
Binary files /dev/null and b/ZIPs/lab14_CalebFontenot.zip differ