diff --git a/.gitignore b/.gitignore index d3724b6..25e95cc 100644 --- a/.gitignore +++ b/.gitignore @@ -98,3 +98,5 @@ /Semester 2/Assignments/lab-2D-arrays-sort_CalebFontenot/target/ /Semester 2/Assignments/lab3_CalebFontenot/target/ /Semester 2/Assignments/MP1_CalebFontenot/target/ +/Semester 2/Assignments/MP2_CalebFontenot/target/ +/Semester 2/Assignments/lab2_CalebFontenot/target/ diff --git a/Semester 2/Assignments/MP2_CalebFontenot/pom.xml b/Semester 2/Assignments/MP2_CalebFontenot/pom.xml new file mode 100644 index 0000000..5240f8f --- /dev/null +++ b/Semester 2/Assignments/MP2_CalebFontenot/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.calebfontenot + MP2_CalebFontenot + 1.0-SNAPSHOT + jar + + UTF-8 + 1.8 + 1.8 + com.calebfontenot.mp2_calebfontenot.MP2_CalebFontenot + + \ No newline at end of file diff --git a/Semester 2/Assignments/MP2_CalebFontenot/src/main/java/com/calebfontenot/mp2_calebfontenot/MP2_CalebFontenot.java b/Semester 2/Assignments/MP2_CalebFontenot/src/main/java/com/calebfontenot/mp2_calebfontenot/MP2_CalebFontenot.java new file mode 100644 index 0000000..376aa1b --- /dev/null +++ b/Semester 2/Assignments/MP2_CalebFontenot/src/main/java/com/calebfontenot/mp2_calebfontenot/MP2_CalebFontenot.java @@ -0,0 +1,16 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + */ + +package com.calebfontenot.mp2_calebfontenot; + +/** + * + * @author caleb + */ +public class MP2_CalebFontenot { + + public static void main(String[] args) { + System.out.println("Hello World!"); + } +} diff --git a/Semester 2/Assignments/lab2_CalebFontenot/lab2-1.pdf b/Semester 2/Assignments/lab2_CalebFontenot/lab2-1.pdf new file mode 100644 index 0000000..dd355a7 Binary files /dev/null and b/Semester 2/Assignments/lab2_CalebFontenot/lab2-1.pdf differ diff --git a/Semester 2/Assignments/lab2_CalebFontenot/pom.xml b/Semester 2/Assignments/lab2_CalebFontenot/pom.xml new file mode 100644 index 0000000..34fa50a --- /dev/null +++ b/Semester 2/Assignments/lab2_CalebFontenot/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.calebfontenot + lab5_CalebFontenot + 1.0-SNAPSHOT + jar + + UTF-8 + 17 + 17 + com.calebfontenot.lab5_calebfontenot.Lab5_CalebFontenot + + \ No newline at end of file diff --git a/Semester 2/Assignments/lab2_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Lab5_CalebFontenot.java b/Semester 2/Assignments/lab2_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Lab5_CalebFontenot.java new file mode 100644 index 0000000..61e8855 --- /dev/null +++ b/Semester 2/Assignments/lab2_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Lab5_CalebFontenot.java @@ -0,0 +1,16 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + */ + +package com.calebfontenot.lab5_calebfontenot; + +/** + * + * @author caleb + */ +public class Lab5_CalebFontenot { + + public static void main(String[] args) { + System.out.println("Hello World!"); + } +} diff --git a/Semester 2/Assignments/lab2_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/TrueFalseQuestion.java b/Semester 2/Assignments/lab2_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/TrueFalseQuestion.java new file mode 100644 index 0000000..bc36c59 --- /dev/null +++ b/Semester 2/Assignments/lab2_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/TrueFalseQuestion.java @@ -0,0 +1,86 @@ +/* + * 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.Date; + +/** + * + * @author caleb + */ +public class TrueFalseQuestion { + + private String question; + private boolean isTrue; + private Date whenLastUsed; + + public TrueFalseQuestion(){} + public TrueFalseQuestion(String question, boolean isTrue, Date whenLastUsed) { + this.question = question; + this.isTrue = isTrue; + this.whenLastUsed = whenLastUsed; + } + + /** + * Get the value of whenLastUsed + * + * @return the value of whenLastUsed + */ + public Date getWhenLastUsed() + { + return whenLastUsed; + } + + /** + * Set the value of whenLastUsed + * + * @param whenLastUsed new value of whenLastUsed + */ + public void setWhenLastUsed(Date whenLastUsed) + { + this.whenLastUsed = whenLastUsed; + } + + + /** + * Get the value of isTrue + * + * @return the value of isTrue + */ + public boolean isIsTrue() + { + return isTrue; + } + + /** + * Set the value of isTrue + * + * @param isTrue new value of isTrue + */ + public void setIsTrue(boolean isTrue) + { + this.isTrue = isTrue; + } + + /** + * Get the value of question + * + * @return the value of question + */ + public String getQuestion() + { + return question; + } + +/**Sets the question to a new question. + * + * @param question the new question + */ + public void setQuestion(String question) + { + this.question = question; + } + +} diff --git a/Semester 2/Assignments/lab2_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/TrueFalseQuiz.java b/Semester 2/Assignments/lab2_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/TrueFalseQuiz.java new file mode 100644 index 0000000..89acfea --- /dev/null +++ b/Semester 2/Assignments/lab2_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/TrueFalseQuiz.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.lab5_calebfontenot; + +import java.util.Date; + +/** + * + * @author caleb + */ +public class TrueFalseQuiz { + int currentQuestion; + TrueFalseQuestion[] trueFalseQuestions; + + public TrueFalseQuiz() { + trueFalseQuestions = new TrueFalseQuestion[5]; + + trueFalseQuestions[0] = + new TrueFalseQuestion("The Pacific Ocean is larger than the Atlantic Ocean.", + true, new Date()); + + trueFalseQuestions[1] = + new TrueFalseQuestion("The Suez Canal connects the Red Sea and the Indian Ocean.", false, new Date()); + + trueFalseQuestions[2] = + new TrueFalseQuestion("The source of the nile River is in Egypt.", false, new Date()); + + trueFalseQuestions[3] = + new TrueFalseQuestion("Lake Baikal is the world\'s oldest and deepest freshwater lake.", true, new Date()); + + trueFalseQuestions[4] = + new TrueFalseQuestion("The Amazon River is the longest river in the Americas.", true, new Date()); + this.currentQuestion = 0; + } + + public TrueFalseQuiz(String[] questions, boolean[] trueFalse) { + //> Create an array of REFERENCES of size questions.length + //the references are initializesed to null + trueFalseQuestions = new TrueFalseQuestion[questions.length]; + + //> assign to each reference of the array an object of type TrueFalseQuestion + for(int i = 0, j = 0; i < questions.length; ++i,++j) { + trueFalseQuestions[i] = new TrueFalseQuestion( + questions[i], + trueFalse[j], + new Date()); + //> set the index of the first question + this.currentQuestion = 0; + } + } +} diff --git a/Semester 2/Assignments/lab3_CalebFontenot/src/main/java/jan17/Circle.java b/Semester 2/Assignments/lab3_CalebFontenot/src/main/java/jan17/Circle.java index 2f438b5..0ca5451 100644 --- a/Semester 2/Assignments/lab3_CalebFontenot/src/main/java/jan17/Circle.java +++ b/Semester 2/Assignments/lab3_CalebFontenot/src/main/java/jan17/Circle.java @@ -18,13 +18,15 @@ public class Circle { public Circle() { - numberOfObjectsRunning++; + this(0); + numberOfObjectsRunning++; } public Circle(double radius) { numberOfObjectsRunning++; this.radius = radius; + this.dateOfCreation = new Date(); } /** @@ -59,6 +61,11 @@ public class Circle { return dateOfCreation; } + public Circle getCircle() { + return this; + } + + /** * Set the value of dateOfCreation * @@ -114,6 +121,31 @@ public class Circle { System.out.println(new java.util.Random().nextInt()); System.out.println(c1); System.out.println(c1.toString()); + System.out.println(); + + printMultiples(c1, 4); + System.out.println(); + + Circle[] ar = new Circle[3]; + ar[0] = c1; + ar[1] = new Circle(10); + ar[2] = new Circle(3.8); + Circle.printArray(ar); + System.out.println(c1.getCircle()); + + } + + public static void printArray(Circle[] ar) + { + for (Circle ar1: ar) { + System.out.println(ar1); + } } +public static void printMultiples(Circle c, int howManyTimes) { + for (int i = 0; i < howManyTimes; ++i) { + System.out.println(c); +} +} + } diff --git a/Semester 2/Assignments/lab3_CalebFontenot/src/main/java/jan17/TestImmutable.java b/Semester 2/Assignments/lab3_CalebFontenot/src/main/java/jan17/TestImmutable.java new file mode 100644 index 0000000..a422223 --- /dev/null +++ b/Semester 2/Assignments/lab3_CalebFontenot/src/main/java/jan17/TestImmutable.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 jan17; + +/** + * + * @author caleb + */ +public class TestImmutable { + public static void main(String[] args) + { + Circle c = new Circle(10); + System.out.println(c); + Circle c1 = c.getCircle(); + c1.getDateOfCreation().setTime(1234567); + System.out.println(c1); + } +}