diff --git a/.gitignore b/.gitignore
index 0068b18..65fe8a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -106,3 +106,6 @@
/Semester 2/Assignments/MP3_CalebFontenot/nbproject/private/
/Semester 2/TestProject/target/
/Semester 2/Assignments/MP3_CalebFontenot/build/
+/Semester 2/Assignments/lab4_CalebFontenot/target/
+/Semester 2/Exams/PracticeExam1/target/
+/Semester 2/Assignments/lab5_CalebFontenot/target/
diff --git a/Semester 2/Assignments/lab4_CalebFontenot/pom.xml b/Semester 2/Assignments/lab4_CalebFontenot/pom.xml
new file mode 100644
index 0000000..dcf8920
--- /dev/null
+++ b/Semester 2/Assignments/lab4_CalebFontenot/pom.xml
@@ -0,0 +1,14 @@
+
+
+ 4.0.0
+ com.calebfontenot
+ lab4_CalebFontenot
+ 1.0-SNAPSHOT
+ jar
+
+ UTF-8
+ 1.8
+ 1.8
+ com.calebfontenot.lab4_calebfontenot.Lab4_CalebFontenot
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/Circle.java b/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/Circle.java
new file mode 100644
index 0000000..9956801
--- /dev/null
+++ b/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/Circle.java
@@ -0,0 +1,51 @@
+/*
+ * 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.lab4_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class Circle extends GeometricObject {
+ private double radius;
+
+ public Circle() {
+ }
+
+ public Circle(double radius) {
+ this.radius = radius;
+ }
+
+ /** Return radius */
+ public double getRadius() {
+ return radius;
+ }
+
+ /** Set a new radius */
+ public void setRadius(double radius) {
+ this.radius = radius;
+ }
+
+ @Override /** Return area */
+ public double getArea() {
+ return radius * radius * Math.PI;
+ }
+
+ /** Return diameter */
+ public double getDiameter() {
+ return 2 * radius;
+ }
+
+ @Override /** Return perimeter */
+ public double getPerimeter() {
+ return 2 * radius * Math.PI;
+ }
+
+ /* Print the circle info */
+ public void printCircle() {
+ System.out.println("The circle is created " + getDateCreated() +
+ " and the radius is " + radius);
+ }
+}
diff --git a/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/GeometricObject.java b/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/GeometricObject.java
new file mode 100644
index 0000000..a44de29
--- /dev/null
+++ b/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/GeometricObject.java
@@ -0,0 +1,65 @@
+/*
+ * 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.lab4_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public abstract class GeometricObject {
+ private String color = "white";
+ private boolean filled;
+ private java.util.Date dateCreated;
+
+ /** Construct a default geometric object */
+ protected GeometricObject() {
+ dateCreated = new java.util.Date();
+ }
+
+ /** Construct a geometric object with color and filled value */
+ protected GeometricObject(String color, boolean filled) {
+ dateCreated = new java.util.Date();
+ this.color = color;
+ this.filled = filled;
+ }
+
+ /** Return color */
+ public String getColor() {
+ return color;
+ }
+
+ /** Set a new color */
+ public void setColor(String color) {
+ this.color = color;
+ }
+
+ /** Return filled. Since filled is boolean,
+ * the get method is named isFilled */
+ public boolean isFilled() {
+ return filled;
+ }
+
+ /** Set a new filled */
+ public void setFilled(boolean filled) {
+ this.filled = filled;
+ }
+
+ /** Get dateCreated */
+ public java.util.Date getDateCreated() {
+ return dateCreated;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "GeometricObject{" + "color=" + color + ", filled=" + filled + ", dateCreated=" + dateCreated + '}';
+ }
+
+ /** Abstract method getArea */
+ public abstract double getArea();
+
+ /** Abstract method getPerimeter */
+ public abstract double getPerimeter();
+}
diff --git a/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/Lab4_CalebFontenot.java b/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/Lab4_CalebFontenot.java
new file mode 100644
index 0000000..35ee0be
--- /dev/null
+++ b/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/Lab4_CalebFontenot.java
@@ -0,0 +1,16 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ */
+
+package com.calebfontenot.lab4_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class Lab4_CalebFontenot {
+
+ public static void main(String[] args) {
+ System.out.println("Hello World!");
+ }
+}
diff --git a/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/Rectangle.java b/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/Rectangle.java
new file mode 100644
index 0000000..be8f105
--- /dev/null
+++ b/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/Rectangle.java
@@ -0,0 +1,52 @@
+/*
+ * 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.lab4_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class Rectangle extends GeometricObject {
+ private double width;
+ private double height;
+
+ public Rectangle() {
+ }
+
+ public Rectangle(double width, double height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ /** Return width */
+ public double getWidth() {
+ return width;
+ }
+
+ /** Set a new width */
+ public void setWidth(double width) {
+ this.width = width;
+ }
+
+ /** Return height */
+ public double getHeight() {
+ return height;
+ }
+
+ /** Set a new height */
+ public void setHeight(double height) {
+ this.height = height;
+ }
+
+ @Override /** Return area */
+ public double getArea() {
+ return width * height;
+ }
+
+ @Override /** Return perimeter */
+ public double getPerimeter() {
+ return 2 * (width + height);
+ }
+}
\ No newline at end of file
diff --git a/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/TestCircleRectangle.java b/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/TestCircleRectangle.java
new file mode 100644
index 0000000..55c9f1d
--- /dev/null
+++ b/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/TestCircleRectangle.java
@@ -0,0 +1,48 @@
+/*
+ * 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.lab4_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class TestCircleRectangle {
+ public static void main(String[] args) {
+ Circle circle = new Circle(1);
+ System.out.println(circle);
+ /*
+ CircleFromSimpleGeometricObject circle =
+ new CircleFromSimpleGeometricObject(1);
+ System.out.println("A circle " + circle.toString());
+ System.out.println("The color is " + circle.getColor());
+ System.out.println("The radius is " + circle.getRadius());
+ System.out.println("The area is " + circle.getArea());
+ System.out.println("The diameter is " + circle.getDiameter());
+
+ RectangleFromSimpleGeometricObject rectangle =
+ new RectangleFromSimpleGeometricObject(2, 4);
+ System.out.println("\nA rectangle " + rectangle.toString());
+ System.out.println("The area is " + rectangle.getArea());
+ System.out.println("The perimeter is " +
+ rectangle.getPerimeter());
+ */
+}
+
+
+
+ class Apple extends Fruit {
+
+}
+
+ class Fruit {
+ public Fruit () {}
+ public Fruit(String name) {
+ System.out.println("Fruit's constructior is invoked.");
+ }
+ }
+
+}
+
+
diff --git a/Semester 2/Assignments/lab5_CalebFontenot/lab4.pdf b/Semester 2/Assignments/lab5_CalebFontenot/lab4.pdf
new file mode 100644
index 0000000..39e7bba
Binary files /dev/null and b/Semester 2/Assignments/lab5_CalebFontenot/lab4.pdf differ
diff --git a/Semester 2/Assignments/lab5_CalebFontenot/pom.xml b/Semester 2/Assignments/lab5_CalebFontenot/pom.xml
new file mode 100644
index 0000000..c82780f
--- /dev/null
+++ b/Semester 2/Assignments/lab5_CalebFontenot/pom.xml
@@ -0,0 +1,14 @@
+
+
+ 4.0.0
+ com.calebfontenot
+ lab5_CalebFontenot
+ 1.0-SNAPSHOT
+ jar
+
+ UTF-8
+ 1.8
+ 1.8
+ com.calebfontenot.lab5_calebfontenot.Lab5_CalebFontenot
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/A.java b/Semester 2/Assignments/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/A.java
new file mode 100644
index 0000000..cd8eff9
--- /dev/null
+++ b/Semester 2/Assignments/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/A.java
@@ -0,0 +1,32 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ */
+package com.calebfontenot.lab5_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class A {
+ public A() { System.out.println("A constructor was called"); }
+ public A(String msg) {System.out.println(msg);}
+ public A(String msg1, String msg2) {
+ this (msg1 + "; " + msg2);
+ System.out.println("A 2-parm constructor was called");
+ }
+ public void instanceMethod1() { System.out.println("Instance method1 called from A"); }
+ public void instanceMethod2() { System.out.println("Instance method2 called from A"); }
+ public static void staticMethod() {System.out.println("Static method 2 called from A"); }
+}
+
+class B extends A {
+ public B() {System.out.println("B constructor called");}
+ public B(String msg)
+ {
+ System.out.println("B constructor called");
+ System.out.println(msg);
+ }
+ public void instanceMethod1() { System.out.println("Instance method1 called from B"); }
+ public void instanceMethod2() { System.out.println("Instance method2 called from B"); }
+ public static void staticMethod() {System.out.println("Static method 2 called from B"); }
+}
diff --git a/Semester 2/Assignments/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Person.java b/Semester 2/Assignments/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Person.java
new file mode 100644
index 0000000..7e0373c
--- /dev/null
+++ b/Semester 2/Assignments/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Person.java
@@ -0,0 +1,152 @@
+/*
+ * 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.lab5_calebfontenot;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+/**
+ *
+ * @author caleb
+ */
+public class Person {
+ //name, addresss, phone number, and email addresss
+
+ private String name;
+ private String address;
+ private String phoneNumber;
+ private String email;
+
+ public Person(String name, String address, String phoneNumber, String email)
+ {
+ this.name = name;
+ this.address = address;
+ this.phoneNumber = phoneNumber;
+ this.email = email;
+ }
+
+ public String getEmailAddress() {return email;}
+ public void setEmailAddress(String email) {this.email = email;}
+ public String getPhoneNumber(){return phoneNumber;}
+ public void setPhoneNumber(String phoneNumber) {this.phoneNumber = phoneNumber;}
+ public String getAddress() {return address;}
+ public void setAddress(String address){ this.address = address;}
+ public String getName() {return name;}
+ public void setName(String name) {this.name = name;}
+
+ @Override
+ public String toString()
+ {
+ return "Person{" + "name=" + name + '}';
+ }
+
+ public static void main(String[] args)
+ {
+ ArrayList list = new ArrayList();
+ list.add(new Person("John Wayne", "123 Sunny Dr. Santa Barabara, 90611", "922-337-3231", "jw@gmail.com"));
+ list.add(new Date());
+ list.add("This is a string");
+ list.add(new String("This is another string"));
+ list.add(new Employee("123", 1234567, new Date(), "Mary Poppins", "123 Blake Drive, Lafayette, LA, 70506", "337-123-4567", "mp@gmail.com"));
+ for (int i = 0; i < list.size(); ++i) {
+ System.out.println(list.get(i));
+ }
+
+ }
+}
+class Student extends Person {
+
+ private Status status;
+ public Status getStatus() {return status;}
+ public void setStatus(Status status) {this.status = status;}
+
+ public Student(Status status, String name, String address, String phoneNumber, String email)
+ {
+ super(name, address, phoneNumber, email);
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {return super.toString() + "Student{" + '}';}
+}
+class Employee extends Person {
+ // office, salary, and data hired
+ private String office;
+ private double salary;
+ private Date dateHired;
+
+ public Employee(String office, double salary, Date dateHired, String name, String address, String phoneNumber, String email)
+ {
+ super(name, address, phoneNumber, email);
+ this.office = office;
+ this.salary = salary;
+ this.dateHired = dateHired;
+ }
+
+
+
+ public Date getDateHired() {return dateHired;}
+ public double getSalary() {return salary;}
+ public void setSalary(double salary) {this.salary = salary;}
+ public String getOffice() {return office;}
+ public void setOffice(String office) {this.office = office;}
+
+ @Override
+ public String toString() {return super.toString() + "Employee{" + '}';}
+}
+class Faculty extends Employee {
+
+ private String officeHours;
+ private int rank;
+
+ public Faculty(String officeHours, int rank, String office, double salary, Date dateHired, String name, String address, String phoneNumber, String email)
+ {
+ super(office, salary, dateHired, name, address, phoneNumber, email);
+ this.officeHours = officeHours;
+ this.rank = rank;
+ }
+
+
+
+ public int getRank(){return rank;}
+ public void setRank(int rank) {this.rank = rank;}
+ public String getOfficeHours() {return officeHours;}
+ public void setOfficeHours(String officeHours) {this.officeHours = officeHours;}
+
+ @Override
+ public String toString() {return "Faculty{name=" + this.getName() + ", " +"rank=" + rank + '}';}
+
+}
+class Staff extends Employee {
+
+ private String title;
+
+ public Staff(String title, String office, double salary, Date dateHired, String name, String address, String phoneNumber, String email)
+ {
+ super(office, salary, dateHired, name, address, phoneNumber, email);
+ this.title = title;
+ }
+
+
+
+ public String getTitle() {return title;}
+ public void setTitle(String title) {this.title = title;}
+
+ @Override
+ public String toString() {return "Staff{name=" + this.getName() + ", " +"title=" + title + '}';}
+}
+class Status {
+
+ final private String status;
+ public Status(String status) { this.status = status;}
+ public String getStatus()
+ {
+ return status;
+ }
+
+ @Override
+ public String toString() {return "Status{" + "status=" + status + '}';}
+
+}
\ No newline at end of file
diff --git a/Semester 2/Assignments/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/lab5_CalebFontenot.java b/Semester 2/Assignments/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/lab5_CalebFontenot.java
new file mode 100644
index 0000000..e253f88
--- /dev/null
+++ b/Semester 2/Assignments/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/lab5_CalebFontenot.java
@@ -0,0 +1,38 @@
+/*
+ * 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.lab5_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class lab5_CalebFontenot {
+ public static void main(String[] args)
+ {
+ //B b = new B("hi");
+ //A a = new A("msg1: The 2-parm constructor of A uses \"this\"",
+ // "msg2: to call the 1-parm constructor of A ");
+ //A a1 = new A();
+ //B b1 = new B();
+ //a.instanceMethod1();
+ //a.instanceMethod2();
+ //A.staticMethod();
+
+ //b.instanceMethod1();
+ //b.instanceMethod2();
+ //B.staticMethod();
+
+ //A a3 = new B();
+ //a3.instanceMethod1();
+
+ //testPolymorphism(a1);
+ //testPolymorphism(b1);
+
+ B b2 = (B) new A();
+ }
+ public static void testPolymorphism(A a) {
+ a.instanceMethod1();
+ }
+}
diff --git a/Semester 2/Exams/Exam1_CalebFontenot/Location.html b/Semester 2/Exams/Exam1_CalebFontenot/Location.html
new file mode 100644
index 0000000..99cbf35
--- /dev/null
+++ b/Semester 2/Exams/Exam1_CalebFontenot/Location.html
@@ -0,0 +1,83 @@
+
+
+
+Location.java
+
+
+
+
+C:\Users\ar114\Documents\NetBeansProjects\Exam1_CalebFontenot\src\main\java\com\calebfontenot\exam1_calebfontenot\Location.java |
+
+
+nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
+nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
+
+package com.calebfontenot.exam1_calebfontenot;
+
+
+
+@author
+
+public class Location {
+
+ public static int row;
+ public static int column;
+ public static double maxValue;
+
+ int x, y;
+ Location(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ public static Location locateLargest(double[][] arr) {
+ maxValue = arr[0][0];
+
+ for (int i = 0; i < arr.length - 1; ++i) {
+ for (int j = 0; j < arr[i].length; ++j) {
+ if (maxValue < arr[i][j]) {
+ maxValue = arr[i][j];
+ column = i;
+ row = j;
+ }
+ }
+ }
+ return new Location(column, row);
+ }
+
+ @Override
+ public String toString() {
+ String s = "The location of the largest element is ";
+ s += maxValue + " at (" + this.x + ", "+ this.y +")";
+ return s;
+ }
+
+ public static void main(String[] args) {
+ double[][] arr = {
+ {23.5, 35, 2, 10, 12},
+ {4.5, 3, 45},
+ {35, 44, 5.5, 9.6}
+ };
+ System.out.println(locateLargest(arr));
+
+ }
+}
+
+
+
diff --git a/Semester 2/Exams/Exam1_CalebFontenot/MyStringBuilder.html b/Semester 2/Exams/Exam1_CalebFontenot/MyStringBuilder.html
new file mode 100644
index 0000000..199fc2c
--- /dev/null
+++ b/Semester 2/Exams/Exam1_CalebFontenot/MyStringBuilder.html
@@ -0,0 +1,152 @@
+
+
+
+MyStringBuilder.java
+
+
+
+
+C:\Users\ar114\Documents\NetBeansProjects\Exam1_CalebFontenot\src\main\java\com\calebfontenot\exam1_calebfontenot\MyStringBuilder.java |
+
+
+nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
+nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
+
+package com.calebfontenot.exam1_calebfontenot;
+
+import java.util.Arrays;
+
+
+
+@author
+
+public class MyStringBuilder {
+
+
+
+ private char[] buffer;
+
+ public MyStringBuilder() {
+ }
+
+ public MyStringBuilder(char[] chars) {
+ buffer = chars;
+ }
+
+ public MyStringBuilder(String s) {
+ buffer = s.toCharArray();
+ }
+
+ private void increaseCapacity(int newCapacity) {
+ char[] temp = new char[newCapacity];
+ System.arraycopy(buffer, 0, temp, 0, buffer.length);
+ buffer = temp;
+ }
+
+ public MyStringBuilder append(MyStringBuilder s) {
+ int oldLength = buffer.length;
+ char[] toAdd = s.buffer;
+ increaseCapacity(toAdd.length + oldLength);
+ int j = 0;
+ for (int i = oldLength; i < (oldLength + s.buffer.length); ++i) {
+ buffer[i] = toAdd[j++];
+ }
+ return this;
+ }
+
+
+public MyStringBuilder append(int i
+
+
+
+@return
+
+
+ public int length() {
+ return buffer.length -1;
+ }
+
+ public char charAt(int index) {
+ return buffer[index];
+ }
+
+ public MyStringBuilder toLowerCase() {
+ for (int i = 0; i < buffer.length; ++i) {
+ buffer[i] = Character.toLowerCase(buffer[i]);
+ }
+ return this;
+ }
+
+ public MyStringBuilder substring(int begin, int end) {
+ String s = "";
+ for (int i = begin; i < end; ++i) {
+ s += buffer[i];
+ }
+ return new MyStringBuilder(s.toCharArray());
+ }
+
+ @Override
+ public String toString() {
+ String s = "";
+ for(char c: buffer)
+ {
+ s += c;
+ }
+ return s;
+ }
+
+ public MyStringBuilder reverse() {
+ char[] reversed = new char[buffer.length];
+ int j = 0;
+ for (int i = buffer.length - 1; i >= 0; --i) {
+ reversed[i] = buffer[j];
+ j++;
+ }
+ buffer = reversed;
+ return this;
+ }
+
+ public MyStringBuilder substring(int begin) {
+ return substring(begin, buffer.length);
+ }
+
+ public MyStringBuilder toUpperCase() {
+ for (int i = 0; i < buffer.length; ++i) {
+ buffer[i] = Character.toUpperCase(buffer[i]);
+ }
+ return this;
+ }
+
+ public static void main(String[] args) {
+ MyStringBuilder s1 = new MyStringBuilder("Welcomne to");
+ MyStringBuilder s2 = new MyStringBuilder(" Java");
+
+ System.out.println(s1.length());
+ System.out.println(s1.charAt(3));
+ System.out.println(s1.toUpperCase().toString());
+ s1.append(s2);
+ System.out.println(s1.toString());
+ System.out.println(s1.substring(1, 4));
+ System.out.println(s1.reverse());
+ System.out.println(s1.reverse());
+ }
+}
+
+
+
diff --git a/Semester 2/Exams/Exam1_CalebFontenot/Question1.html b/Semester 2/Exams/Exam1_CalebFontenot/Question1.html
new file mode 100644
index 0000000..b3e4246
--- /dev/null
+++ b/Semester 2/Exams/Exam1_CalebFontenot/Question1.html
@@ -0,0 +1,82 @@
+
+
+
+Question1.java
+
+
+
+
+C:\Users\ar114\Documents\NetBeansProjects\Exam1_CalebFontenot\src\main\java\com\calebfontenot\exam1_calebfontenot\Question1.java |
+
+
+nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
+nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
+
+package com.calebfontenot.exam1_calebfontenot;
+
+
+
+@author
+
+public class Question1 {
+
+ public static void sort(int[] arr) {
+ for (int i = 0; i < arr.length - 1; ++i) {
+ for (int j = i + 1; j < arr.length; ++j) {
+ if (arr[i] > arr[j]) {
+ int temp = arr[i];
+ arr[i] = arr[j];
+ arr[j] = temp;
+ }
+ }
+ }
+ }
+
+ public static void print(int[][][] arr) {
+ for (int i = 0; i < arr.length; ++i) {
+ for (int j = 0; j < arr[i].length; ++j) {
+ for (int k = 0; k < arr[i][j].length; ++k) {
+ System.out.print(arr[i][j][k] + " ");
+ }
+ System.out.println();
+ }
+ }
+ }
+ public static void main(String[] args) {
+ int[][][] arr = {
+ {
+ {11, 2, 6, 22}, {3, 90, 112, 40, 7, 12}
+ },
+ {
+ {10, -20, 3}, {300, 50}
+ }
+
+ };
+ for (int i = 0; i < arr.length; ++i) {
+ for (int j = 0; j < arr[i].length; ++j) {
+ sort(arr[i][j]);
+ }
+ }
+
+ print(arr);
+ }
+}
+
+
+
diff --git a/Semester 2/Exams/Exam1_CalebFontenot/pom.xml b/Semester 2/Exams/Exam1_CalebFontenot/pom.xml
new file mode 100644
index 0000000..1db546b
--- /dev/null
+++ b/Semester 2/Exams/Exam1_CalebFontenot/pom.xml
@@ -0,0 +1,14 @@
+
+
+ 4.0.0
+ com.calebfontenot.exam1_calebfontenot
+ Exam1_CalebFontenot
+ 1.0-SNAPSHOT
+ jar
+
+ UTF-8
+ 11
+ 11
+ com.calebfontenot.exam1_calebfontenot.Exam1_CalebFontenot
+
+
\ No newline at end of file
diff --git a/Semester 2/Exams/Exam1_CalebFontenot/src/main/java/com/calebfontenot/exam1_calebfontenot/Exam1_CalebFontenot.java b/Semester 2/Exams/Exam1_CalebFontenot/src/main/java/com/calebfontenot/exam1_calebfontenot/Exam1_CalebFontenot.java
new file mode 100644
index 0000000..7a7619a
--- /dev/null
+++ b/Semester 2/Exams/Exam1_CalebFontenot/src/main/java/com/calebfontenot/exam1_calebfontenot/Exam1_CalebFontenot.java
@@ -0,0 +1,17 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
+ */
+
+package com.calebfontenot.exam1_calebfontenot;
+
+/**
+ *
+ * @author ar114
+ */
+public class Exam1_CalebFontenot {
+
+ public static void main(String[] args) {
+ System.out.println("Hello World!".toUpperCase());
+ }
+}
diff --git a/Semester 2/Exams/Exam1_CalebFontenot/src/main/java/com/calebfontenot/exam1_calebfontenot/Location.java b/Semester 2/Exams/Exam1_CalebFontenot/src/main/java/com/calebfontenot/exam1_calebfontenot/Location.java
new file mode 100644
index 0000000..0ac6ebd
--- /dev/null
+++ b/Semester 2/Exams/Exam1_CalebFontenot/src/main/java/com/calebfontenot/exam1_calebfontenot/Location.java
@@ -0,0 +1,54 @@
+/*
+ * 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.exam1_calebfontenot;
+
+/**
+ *
+ * @author ar114
+ */
+public class Location {
+
+ public static int row;
+ public static int column;
+ public static double maxValue;
+
+ int x, y;
+ Location(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ public static Location locateLargest(double[][] arr) {
+ maxValue = arr[0][0];
+ //Find max value
+ for (int i = 0; i < arr.length - 1; ++i) {
+ for (int j = 0; j < arr[i].length; ++j) {
+ if (maxValue < arr[i][j]) {
+ maxValue = arr[i][j];
+ column = i;
+ row = j;
+ }
+ }
+ }
+ return new Location(column, row);
+ }
+
+ @Override
+ public String toString() {
+ String s = "The location of the largest element is ";
+ s += maxValue + " at (" + this.x + ", "+ this.y +")";
+ return s;
+ }
+
+ public static void main(String[] args) {
+ double[][] arr = {
+ {23.5, 35, 2, 10, 12},
+ {4.5, 3, 45},
+ {35, 44, 5.5, 9.6}
+ };
+ System.out.println(locateLargest(arr));
+
+ }
+}
diff --git a/Semester 2/Exams/Exam1_CalebFontenot/src/main/java/com/calebfontenot/exam1_calebfontenot/MyStringBuilder.java b/Semester 2/Exams/Exam1_CalebFontenot/src/main/java/com/calebfontenot/exam1_calebfontenot/MyStringBuilder.java
new file mode 100644
index 0000000..f5cab87
--- /dev/null
+++ b/Semester 2/Exams/Exam1_CalebFontenot/src/main/java/com/calebfontenot/exam1_calebfontenot/MyStringBuilder.java
@@ -0,0 +1,123 @@
+/*
+ * 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.exam1_calebfontenot;
+
+import java.util.Arrays;
+
+/**
+ *
+ * @author ar114
+ */
+public class MyStringBuilder {
+
+ //private int size = 0; // Size is not necessary. Remove it and modify the code.
+ //private int capacity = 0; //not necessary
+ private char[] buffer;
+
+ public MyStringBuilder() {
+ }
+
+ public MyStringBuilder(char[] chars) {
+ buffer = chars;
+ }
+
+ public MyStringBuilder(String s) {
+ buffer = s.toCharArray();
+ }
+
+ private void increaseCapacity(int newCapacity) {
+ char[] temp = new char[newCapacity];
+ System.arraycopy(buffer, 0, temp, 0, buffer.length);
+ buffer = temp;
+ }
+
+ public MyStringBuilder append(MyStringBuilder s) {
+ int oldLength = buffer.length;
+ char[] toAdd = s.buffer;
+ increaseCapacity(toAdd.length + oldLength);
+ int j = 0;
+ for (int i = oldLength; i < (oldLength + s.buffer.length); ++i) {
+ buffer[i] = toAdd[j++];
+ }
+ return this;
+ }
+
+ /**
+ * public MyStringBuilder append(int i) {
+ *
+ * }
+ *
+ * @return
+ *
+ */
+ public int length() {
+ return buffer.length -1;
+ }
+
+ public char charAt(int index) {
+ return buffer[index];
+ }
+
+ public MyStringBuilder toLowerCase() {
+ for (int i = 0; i < buffer.length; ++i) {
+ buffer[i] = Character.toLowerCase(buffer[i]);
+ }
+ return this;
+ }
+
+ public MyStringBuilder substring(int begin, int end) {
+ String s = "";
+ for (int i = begin; i < end; ++i) {
+ s += buffer[i];
+ }
+ return new MyStringBuilder(s.toCharArray());
+ }
+
+ @Override
+ public String toString() {
+ String s = "";
+ for(char c: buffer)
+ {
+ s += c;
+ }
+ return s;
+ }
+
+ public MyStringBuilder reverse() {
+ char[] reversed = new char[buffer.length];
+ int j = 0;
+ for (int i = buffer.length - 1; i >= 0; --i) {
+ reversed[i] = buffer[j];
+ j++;
+ }
+ buffer = reversed;
+ return this;
+ }
+
+ public MyStringBuilder substring(int begin) {
+ return substring(begin, buffer.length);
+ }
+
+ public MyStringBuilder toUpperCase() {
+ for (int i = 0; i < buffer.length; ++i) {
+ buffer[i] = Character.toUpperCase(buffer[i]);
+ }
+ return this;
+ }
+
+ public static void main(String[] args) {
+ MyStringBuilder s1 = new MyStringBuilder("Welcome to");
+ MyStringBuilder s2 = new MyStringBuilder(" Java");
+
+ System.out.println(s1.length());
+ System.out.println(s1.charAt(3));
+ System.out.println(s1.toUpperCase().toString());
+ s1.append(s2);
+ System.out.println(s1.toString());
+ System.out.println(s1.substring(1, 4));
+ System.out.println(s1.reverse());
+ System.out.println(s1.reverse());
+ }
+}
diff --git a/Semester 2/Exams/Exam1_CalebFontenot/src/main/java/com/calebfontenot/exam1_calebfontenot/Question1.java b/Semester 2/Exams/Exam1_CalebFontenot/src/main/java/com/calebfontenot/exam1_calebfontenot/Question1.java
new file mode 100644
index 0000000..41e0edb
--- /dev/null
+++ b/Semester 2/Exams/Exam1_CalebFontenot/src/main/java/com/calebfontenot/exam1_calebfontenot/Question1.java
@@ -0,0 +1,53 @@
+/*
+ * 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.exam1_calebfontenot;
+
+/**
+ *
+ * @author ar114
+ */
+public class Question1 {
+
+ public static void sort(int[] arr) {
+ for (int i = 0; i < arr.length - 1; ++i) {
+ for (int j = i + 1; j < arr.length; ++j) {
+ if (arr[i] > arr[j]) {
+ int temp = arr[i];
+ arr[i] = arr[j];
+ arr[j] = temp;
+ }
+ }
+ }
+ }
+
+ public static void print(int[][][] arr) {
+ for (int i = 0; i < arr.length; ++i) {
+ for (int j = 0; j < arr[i].length; ++j) {
+ for (int k = 0; k < arr[i][j].length; ++k) {
+ System.out.print(arr[i][j][k] + " ");
+ }
+ System.out.println();
+ }
+ }
+ }
+ public static void main(String[] args) {
+ int[][][] arr = {
+ {
+ {11, 2, 6, 22}, {3, 90, 112, 40, 7, 12}
+ },
+ {
+ {10, -20, 3}, {300, 50}
+ }
+
+ };
+ for (int i = 0; i < arr.length; ++i) {
+ for (int j = 0; j < arr[i].length; ++j) {
+ sort(arr[i][j]);
+ }
+ }
+
+ print(arr);
+ }
+}
diff --git a/Semester 2/Exams/PracticeExam1/Person.html b/Semester 2/Exams/PracticeExam1/Person.html
new file mode 100644
index 0000000..b1bd3c9
--- /dev/null
+++ b/Semester 2/Exams/PracticeExam1/Person.html
@@ -0,0 +1,111 @@
+
+
+
+Person.java
+
+
+
+
+/home/caleb/ASDV-Java/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/Person.java |
+
+
+nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
+nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
+
+package com.calebfontenot.practiceexam1;
+
+import java.util.GregorianCalendar;
+import java.util.Objects;
+
+
+
+@author
+
+public class Person {
+ private String name;
+ private final GregorianCalendar birthDate;
+
+ public Person(String name, GregorianCalendar brithDate)
+ {
+ this.name = name;
+ this.birthDate = brithDate;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public GregorianCalendar getBirthdate() {
+ return this.birthDate;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final Person other = (Person) obj;
+ if (!Objects.equals(this.name, other.name)) {
+ return false;
+ }
+ return Objects.equals(this.birthDate, other.birthDate);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Person{" + "name=" + name + ", birthDate=" + birthDate.toInstant() + '}';
+ }
+
+
+ public static void main(String[] args)
+ {
+ Person john = new Person("John", new GregorianCalendar(2003, 8, 28));
+ Person mary = new Person("Mary", new GregorianCalendar(2004, 3, 23));
+ System.out.println(john);
+ System.out.println(mary);
+ Person john1 = new Person("John", new GregorianCalendar(2003, 8, 28));
+ Person john2 = new Person("John", new GregorianCalendar(2003, 10, 10));
+ Person john3 = new Person("John", new GregorianCalendar(2003, 8, 28));
+
+ System.out.println(john1.equals(john));
+ System.out.println(john2.equals(john));
+ System.out.println(john3.equals(john));
+
+ }
+}
+
+
+
+
diff --git a/Semester 2/Exams/PracticeExam1/Problem1.html b/Semester 2/Exams/PracticeExam1/Problem1.html
new file mode 100644
index 0000000..27ffbde
--- /dev/null
+++ b/Semester 2/Exams/PracticeExam1/Problem1.html
@@ -0,0 +1,174 @@
+
+
+
+Problem1ArrayNames.java
+
+
+
+
+/home/caleb/ASDV-Java/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/Problem1ArrayNames.java |
+
+
+nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
+nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
+
+package com.calebfontenot.practiceexam1;
+
+import java.util.Arrays;
+import java.util.Scanner;
+
+
+
+@author
+
+
+
+public class Problem1ArrayNames {
+
+ public static int maxNumberOfColumnsInJagged2dArray(char[][] ar)
+ {
+ int maxNumberOfColumns = 0;
+ for (int row = 0; row < ar.length; ++row) {
+ if (ar[row].length > maxNumberOfColumns) {
+ maxNumberOfColumns = ar[row].length;
+ }
+ }
+ return maxNumberOfColumns;
+ }
+
+
+
+@return
+
+ public static int menu()
+ {
+ int userInt = -1;
+ do {
+ System.out.println("Enter the numbrer of students or -1 to quit: ");
+ Scanner input = new Scanner(System.in);
+ userInt = input.nextInt();
+ if (userInt == 0) {
+ System.out.println("Input cannot be 0!");
+ } else {
+ return userInt;
+ }
+ } while (userInt != -1);
+ return -1;
+ }
+
+
+
+
+@param numberOfNames
+@return
+
+ public static char[][] readNames(int numOfNames)
+ {
+ char[][] names = new char[numOfNames][];
+ Scanner input = new Scanner(System.in);
+ for (int i = 0; i < numOfNames; i++) {
+ System.out.print("Enter a name: ");
+ names[i] = input.next().toCharArray();
+ }
+ return names;
+ }
+ public static String returnRowMajorOrder(char[] ar)
+ {
+ String returnString = "";
+ for (int x = 0; x < ar.length; ++x) {
+ returnString += ar[x];
+ }
+ return returnString;
+ }
+
+
+
+
+@param ar
+
+ public static void sortNames(char[][] names)
+ {
+ for (int i = 0; i < names.length - 1; ++i) {
+ for (int j = i + 1; j < names.length; ++j) {
+ char compChar1 = names[i][0], compChar2 = names[j][0];
+
+ for (int rowIterate = 1; rowIterate < maxNumberOfColumnsInJagged2dArray(names); ++rowIterate) {
+ if (Character.toLowerCase(compChar1) == Character.toLowerCase(compChar2)) {
+ try {
+ compChar1 = names[i][rowIterate];
+ compChar2 = names[j][rowIterate];
+ } catch (Exception ex) {
+
+
+ if (names[i].length > names[j].length) {
+ System.out.println(names[i].length + " " + names[j].length);
+ System.out.println("Swapping " + returnRowMajorOrder(names[i]) + " with " + returnRowMajorOrder(names[j]));
+ char[] temp = names[i];
+ names[i] = names[j];
+ names[j] = temp;
+ }
+ break;
+ }
+
+ }
+ if (Character.toLowerCase(compChar1) > Character.toLowerCase(compChar2)) {
+ System.out.println("Swapping " + returnRowMajorOrder(names[i]) + " with " + returnRowMajorOrder(names[j]));
+ char[] temp = names[i];
+ names[i] = names[j];
+ names[j] = temp;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+
+
+
+@param ar
+
+ public static void print(char[][] ar)
+ {
+ for (char[] nested : ar) {
+ System.out.println(Arrays.toString(nested));
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ int numOfNames = menu();
+ char[][] names = null;
+ while (numOfNames != -1) {
+ names = readNames(numOfNames);
+ System.out.println("Original Names:");
+ print(names);
+ System.out.println("Sorted Names:");
+ sortNames(names);
+ print(names);
+ numOfNames = menu();
+ }
+ System.out.println("goodbye!");
+ }
+}
+
+
+
diff --git a/Semester 2/Exams/PracticeExam1/Problem2.html b/Semester 2/Exams/PracticeExam1/Problem2.html
new file mode 100644
index 0000000..6c97af7
--- /dev/null
+++ b/Semester 2/Exams/PracticeExam1/Problem2.html
@@ -0,0 +1,169 @@
+
+
+
+Problem2ArrayObjects.java
+
+
+
+
+/home/caleb/ASDV-Java/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/Problem2ArrayObjects.java |
+
+
+nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
+nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
+
+package com.calebfontenot.practiceexam1;
+
+import java.util.Scanner;
+
+
+
+@author
+
+public class Problem2ArrayObjects {
+
+ private String[] ;
+
+
+
+
+@return
+
+
+ public static int maxNumberOfColumnsInStringArray(String[] ar)
+ {
+ int maxNumberOfColumns = 0;
+ for (int row = 0; row < ar.length; ++row) {
+ if (ar[row].length() > maxNumberOfColumns) {
+ maxNumberOfColumns = ar[row].length();
+ }
+ }
+ return maxNumberOfColumns;
+ }
+
+ public static int menu()
+ {
+ int userInt = -1;
+ do {
+ System.out.println("Enter the numbrer of students or -1 to quit: ");
+ Scanner input = new Scanner(System.in);
+ userInt = input.nextInt();
+ if (userInt == 0) {
+ System.out.println("Input cannot be 0!");
+ } else {
+ return userInt;
+ }
+ } while (userInt != -1);
+ return -1;
+ }
+
+
+
+
+@param numberOfNames
+@return
+
+ public static String[] readNames(int numOfNames)
+ {
+ String[] names = new String[numOfNames];
+ Scanner input = new Scanner(System.in);
+ for (int i = 0; i < numOfNames; i++) {
+ System.out.print("Enter a name: ");
+ names[i] = input.next();
+ }
+ return names;
+ }
+
+
+
+
+@param ar
+@return
+
+public static void sortNames(String[] names)
+ {
+ for (int i = 0; i < names.length - 1; ++i) {
+ for (int j = i + 1; j < names.length; ++j) {
+ char compChar1 = names[i].charAt(0), compChar2 = names[j].charAt(0);
+
+ for (int rowIterate = 1; rowIterate < maxNumberOfColumnsInStringArray(names); ++rowIterate) {
+ if (Character.toLowerCase(compChar1) == Character.toLowerCase(compChar2)) {
+ try {
+ compChar1 = names[i].charAt(rowIterate);
+ compChar2 = names[j].charAt(rowIterate);
+ } catch (Exception ex) {
+
+
+ if (names[i].length() > names[j].length()) {
+ System.out.println(names[i].length() + " " + names[j].length());
+ System.out.println("Swapping " + names[i] + " with " + names[j]);
+ String temp = names[i];
+ names[i] = names[j];
+ names[j] = temp;
+ }
+ break;
+ }
+
+ }
+ if (Character.toLowerCase(compChar1) > Character.toLowerCase(compChar2)) {
+ System.out.println("Swapping " + names[i] + " with " + names[j]);
+ String temp = names[i];
+ names[i] = names[j];
+ names[j] = temp;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+
+
+
+@param ar
+
+ public static void print(String[] arr)
+ {
+ for (String string: arr) {
+ System.out.println(string);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ int numOfNames = menu();
+ String[] names = null;
+ while (numOfNames != -1) {
+ names = readNames(numOfNames);
+ System.out.println("Original Names:");
+ print(names);
+ System.out.println("Sorted Names:");
+ sortNames(names);
+ print(names);
+ numOfNames = menu();
+ }
+ System.out.println("goodbye!");
+ }
+}
+
+
+
+
diff --git a/Semester 2/Exams/PracticeExam1/pom.xml b/Semester 2/Exams/PracticeExam1/pom.xml
new file mode 100644
index 0000000..88b9f6f
--- /dev/null
+++ b/Semester 2/Exams/PracticeExam1/pom.xml
@@ -0,0 +1,14 @@
+
+
+ 4.0.0
+ com.calebfontenot
+ PracticeExam1
+ 1.0-SNAPSHOT
+ jar
+
+ UTF-8
+ 1.8
+ 1.8
+ com.calebfontenot.practiceexam1.PracticeExam1
+
+
\ No newline at end of file
diff --git a/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/Person.java b/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/Person.java
new file mode 100644
index 0000000..9348b61
--- /dev/null
+++ b/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/Person.java
@@ -0,0 +1,80 @@
+/*
+ * 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.practiceexam1;
+
+import java.util.GregorianCalendar;
+import java.util.Objects;
+
+/**
+ *
+ * @author caleb
+ */
+public class Person {
+ private String name;
+ private final GregorianCalendar birthDate;
+
+ public Person(String name, GregorianCalendar brithDate)
+ {
+ this.name = name;
+ this.birthDate = brithDate;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public GregorianCalendar getBirthdate() {
+ return this.birthDate;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final Person other = (Person) obj;
+ if (!Objects.equals(this.name, other.name)) {
+ return false;
+ }
+ return Objects.equals(this.birthDate, other.birthDate);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Person{" + "name=" + name + ", birthDate=" + birthDate.toInstant() + '}';
+ }
+
+
+ public static void main(String[] args)
+ {
+ Person john = new Person("John", new GregorianCalendar(2003, 8, 28));
+ Person mary = new Person("Mary", new GregorianCalendar(2004, 3, 23));
+ System.out.println(john);
+ System.out.println(mary);
+ Person john1 = new Person("John", new GregorianCalendar(2003, 8, 28));
+ Person john2 = new Person("John", new GregorianCalendar(2003, 10, 10));
+ Person john3 = new Person("John", new GregorianCalendar(2003, 8, 28));
+
+ System.out.println(john1.equals(john));
+ System.out.println(john2.equals(john));
+ System.out.println(john3.equals(john));
+
+ }
+}
+
diff --git a/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/PracticeExam1.java b/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/PracticeExam1.java
new file mode 100644
index 0000000..39ff33b
--- /dev/null
+++ b/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/PracticeExam1.java
@@ -0,0 +1,16 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ */
+
+package com.calebfontenot.practiceexam1;
+
+/**
+ *
+ * @author caleb
+ */
+public class PracticeExam1 {
+
+ public static void main(String[] args) {
+ System.out.println("Hello World!");
+ }
+}
diff --git a/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/Problem1ArrayNames.java b/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/Problem1ArrayNames.java
new file mode 100644
index 0000000..ea5127c
--- /dev/null
+++ b/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/Problem1ArrayNames.java
@@ -0,0 +1,143 @@
+/*
+ * 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.practiceexam1;
+
+import java.util.Arrays;
+import java.util.Scanner;
+
+/**
+ *
+ * @author caleb
+ */
+
+
+public class Problem1ArrayNames {
+
+ public static int maxNumberOfColumnsInJagged2dArray(char[][] ar)
+ {
+ int maxNumberOfColumns = 0;
+ for (int row = 0; row < ar.length; ++row) {
+ if (ar[row].length > maxNumberOfColumns) {
+ maxNumberOfColumns = ar[row].length;
+ }
+ }
+ return maxNumberOfColumns;
+ }
+ /**
+ * Displays Enter number of names or -1 to quit
+ *
+ * @return number of students or -1;
+ */
+ public static int menu()
+ {
+ int userInt = -1;
+ do {
+ System.out.println("Enter the numbrer of students or -1 to quit: ");
+ Scanner input = new Scanner(System.in);
+ userInt = input.nextInt();
+ if (userInt == 0) {
+ System.out.println("Input cannot be 0!");
+ } else {
+ return userInt;
+ }
+ } while (userInt != -1);
+ return -1;
+ }
+
+ /**
+ * Reads form user a number of names, creates the array of names and returns it.
+ *
+ * @param numberOfNames
+ * @return array of names.
+ */
+ public static char[][] readNames(int numOfNames)
+ {
+ char[][] names = new char[numOfNames][];
+ Scanner input = new Scanner(System.in);
+ for (int i = 0; i < numOfNames; i++) {
+ System.out.print("Enter a name: ");
+ names[i] = input.next().toCharArray();
+ }
+ return names;
+ }
+ public static String returnRowMajorOrder(char[] ar)//normal
+ {
+ String returnString = "";
+ for (int x = 0; x < ar.length; ++x) {
+ returnString += ar[x];
+ }
+ return returnString;
+ }
+
+ /**
+ * Sorts the array in ascending order.
+ *
+ * @param ar
+ */
+ public static void sortNames(char[][] names)
+ {
+ for (int i = 0; i < names.length - 1; ++i) {
+ for (int j = i + 1; j < names.length; ++j) {
+ char compChar1 = names[i][0], compChar2 = names[j][0];
+ // Reoder entire row
+ for (int rowIterate = 1; rowIterate < maxNumberOfColumnsInJagged2dArray(names); ++rowIterate) {
+ if (Character.toLowerCase(compChar1) == Character.toLowerCase(compChar2)) {
+ try {
+ compChar1 = names[i][rowIterate];
+ compChar2 = names[j][rowIterate];
+ } catch (Exception ex) {
+ // If it's failed, the index has gone out of range.
+ // Check the length of the arrays and swap the larger one with the smaller one.
+ if (names[i].length > names[j].length) {
+ System.out.println(names[i].length + " " + names[j].length);
+ System.out.println("Swapping " + returnRowMajorOrder(names[i]) + " with " + returnRowMajorOrder(names[j]));
+ char[] temp = names[i];
+ names[i] = names[j];
+ names[j] = temp;
+ }
+ break;
+ }
+
+ }
+ if (Character.toLowerCase(compChar1) > Character.toLowerCase(compChar2)) {
+ System.out.println("Swapping " + returnRowMajorOrder(names[i]) + " with " + returnRowMajorOrder(names[j]));
+ char[] temp = names[i];
+ names[i] = names[j];
+ names[j] = temp;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Prints the array
+ *
+ * @param ar is printed
+ */
+ public static void print(char[][] ar)
+ {
+ for (char[] nested : ar) {
+ System.out.println(Arrays.toString(nested));
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ int numOfNames = menu();
+ char[][] names = null;
+ while (numOfNames != -1) {
+ names = readNames(numOfNames);
+ System.out.println("Original Names:");
+ print(names);
+ System.out.println("Sorted Names:");
+ sortNames(names);
+ print(names);
+ numOfNames = menu();
+ }
+ System.out.println("goodbye!");
+ }
+}
diff --git a/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/Problem2ArrayObjects.java b/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/Problem2ArrayObjects.java
new file mode 100644
index 0000000..338bd75
--- /dev/null
+++ b/Semester 2/Exams/PracticeExam1/src/main/java/com/calebfontenot/practiceexam1/Problem2ArrayObjects.java
@@ -0,0 +1,138 @@
+/*
+ * 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.practiceexam1;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author caleb
+ */
+public class Problem2ArrayObjects {
+
+ private String[] names;
+
+ /**
+ * Displays: Enter number of names or -1 to quit
+ *
+ * @return number of students or -1;
+ */
+
+ public static int maxNumberOfColumnsInStringArray(String[] ar)
+ {
+ int maxNumberOfColumns = 0;
+ for (int row = 0; row < ar.length; ++row) {
+ if (ar[row].length() > maxNumberOfColumns) {
+ maxNumberOfColumns = ar[row].length();
+ }
+ }
+ return maxNumberOfColumns;
+ }
+
+ public static int menu()
+ {
+ int userInt = -1;
+ do {
+ System.out.println("Enter the numbrer of students or -1 to quit: ");
+ Scanner input = new Scanner(System.in);
+ userInt = input.nextInt();
+ if (userInt == 0) {
+ System.out.println("Input cannot be 0!");
+ } else {
+ return userInt;
+ }
+ } while (userInt != -1);
+ return -1;
+ }
+
+ /**
+ * Reads form user a number of names, creates the array of names and returns it. Stores the array into this.names
+ *
+ * @param numberOfNames
+ * @return array of names.
+ */
+ public static String[] readNames(int numOfNames)
+ {
+ String[] names = new String[numOfNames];
+ Scanner input = new Scanner(System.in);
+ for (int i = 0; i < numOfNames; i++) {
+ System.out.print("Enter a name: ");
+ names[i] = input.next();
+ }
+ return names;
+ }
+
+ /**
+ * Sorts the array of names in ascending order Does not replace the this.names
+ *
+ * @param ar the array to be sorted
+ * @return returns the sorted array
+ */
+public static void sortNames(String[] names)
+ {
+ for (int i = 0; i < names.length - 1; ++i) {
+ for (int j = i + 1; j < names.length; ++j) {
+ char compChar1 = names[i].charAt(0), compChar2 = names[j].charAt(0);
+ // Reoder entire row
+ for (int rowIterate = 1; rowIterate < maxNumberOfColumnsInStringArray(names); ++rowIterate) {
+ if (Character.toLowerCase(compChar1) == Character.toLowerCase(compChar2)) {
+ try {
+ compChar1 = names[i].charAt(rowIterate);
+ compChar2 = names[j].charAt(rowIterate);
+ } catch (Exception ex) {
+ // If it's failed, the index has gone out of range.
+ // Check the length of the arrays and swap the larger one with the smaller one.
+ if (names[i].length() > names[j].length()) {
+ System.out.println(names[i].length() + " " + names[j].length());
+ System.out.println("Swapping " + names[i] + " with " + names[j]);
+ String temp = names[i];
+ names[i] = names[j];
+ names[j] = temp;
+ }
+ break;
+ }
+
+ }
+ if (Character.toLowerCase(compChar1) > Character.toLowerCase(compChar2)) {
+ System.out.println("Swapping " + names[i] + " with " + names[j]);
+ String temp = names[i];
+ names[i] = names[j];
+ names[j] = temp;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Prints the array of objects
+ *
+ * @param ar is printed
+ */
+ public static void print(String[] arr)
+ {
+ for (String string: arr) {
+ System.out.println(string);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ int numOfNames = menu();
+ String[] names = null;
+ while (numOfNames != -1) {
+ names = readNames(numOfNames);
+ System.out.println("Original Names:");
+ print(names);
+ System.out.println("Sorted Names:");
+ sortNames(names);
+ print(names);
+ numOfNames = menu();
+ }
+ System.out.println("goodbye!");
+ }
+}
+
diff --git a/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/Emoji.java b/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/Emoji.java
new file mode 100644
index 0000000..f6ba26d
--- /dev/null
+++ b/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/Emoji.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 com.calebfontenot.testproject;
+
+/**
+ *
+ * @author caleb
+ */
+public class Emoji {
+ public static void main(String[] args)
+ {
+ char emoji = '😁';
+ System.out.println(emoji);
+ }
+}
diff --git a/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/ParseInt.java b/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/ParseInt.java
new file mode 100644
index 0000000..8e4a121
--- /dev/null
+++ b/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/ParseInt.java
@@ -0,0 +1,21 @@
+/*
+ * 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 ParseInt {
+ public static void main(String[] args)
+ {
+ java.math.BigDecimal bigInt = new java.math.BigDecimal(343.445);
+ System.out.println(bigInt);
+ String string = new String("lol");
+ String string2 = "lol2";
+ System.out.println(string.getClass().getName());
+ System.out.println(string2.getClass().getName());
+ }
+}
diff --git a/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/StringBuilderTest2.java b/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/StringBuilderTest2.java
new file mode 100644
index 0000000..d49826c
--- /dev/null
+++ b/Semester 2/TestProject/src/main/java/com/calebfontenot/testproject/StringBuilderTest2.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+import java.util.*;
+/**
+ *
+ * @author caleb
+ */
+public class StringBuilderTest2 {
+ public static void main(String[] args)
+ {
+ StringBuilder strBuf = new StringBuilder();
+ strBuf.append("ABCDEFG");
+ System.out.println(strBuf);
+ strBuf.insert(3, "RRRR");
+ System.out.println(strBuf);
+
+
+String s1 = "Welcome to Java";
+String s2 = "Welcome to Java";
+System.out.println("s1 == s2 is " + (s1 == s2));
+
+ Circle[] circleArray = new Circle[5];
+ circleArray[0] = "test";
+ for (Circle object: circleArray) {
+ System.out.println(object);
+ }
+ }
+}
+
+public class Circle {
+ Circle() {
+
+ }
+}
\ No newline at end of file