diff --git a/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/Bicycle.html b/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/Bicycle.html
new file mode 100644
index 0000000..c219a7d
--- /dev/null
+++ b/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/Bicycle.html
@@ -0,0 +1,298 @@
+
+
+
+BikeStores.java
+
+
+
+
+/home/caleb/ASDV-Java/Semester 2/Assignments/MP4_CalebFontenot/src/main/java/com/calebfontenot/mp4_calebfontenot/BikeStores.java |
+
+
+nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
+nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
+
+package com.calebfontenot.mp4_calebfontenot;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+
+
+@author
+
+public class BikeStores {
+
+ ArrayList<ArrayList<Bicycle>> storesOfBikes = new ArrayList<ArrayList<Bicycle>>();
+
+
+
+
+@param storeNumber
+@param b
+@return
+
+ public BikeStores() {
+ for (int i = 0; i < 3; i++) {
+ storesOfBikes.add(new ArrayList<Bicycle>());
+ }
+ }
+
+ public boolean addBike(int storeNumber, Bicycle b) {
+ if (storeNumber < 0 || storeNumber > this.storesOfBikes.size() - 1) {
+ return false;
+ }
+ if (b == null) {
+ return false;
+ }
+ System.out.println("Attempting to add " + b + " to store at index " + storeNumber);
+
+ ArrayList<Bicycle> bikesInInventory = storesOfBikes.get(storeNumber);
+ bikesInInventory.add(b);
+
+
+ storesOfBikes.set(storeNumber, bikesInInventory);
+ System.out.println("success!");
+ return true;
+ }
+
+
+
+
+@param storeNumber
+@param b
+@return
+
+ public boolean removeBike(int storeNumber, Bicycle b) {
+ if (storeNumber < 0 || storeNumber > this.storesOfBikes.size() - 1) {
+ return false;
+ }
+ if (b == null) {
+ return false;
+ }
+ System.out.println("Attempting to remove " + b + " to store at index " + storeNumber);
+
+ ArrayList<Bicycle> bikesInInventory = storesOfBikes.get(storeNumber);
+ bikesInInventory.remove(b);
+ System.out.println("success!");
+ return true;
+ }
+
+
+
+
+@param stores
+
+ public static void print(ArrayList<ArrayList<Bicycle>> stores) {
+ for (int i = 0; i < stores.size(); ++i) {
+ System.out.println("---------- " + "printing row " + (i + 1) + " ----------");
+ for (int j = 0; j < stores.get(i).size(); ++j) {
+ System.out.println(stores.get(i).get(j) + " ");
+
+ }
+ }
+ }
+
+ public static void printSingle(ArrayList<Bicycle> stores) {
+ System.out.println("----------" + "printSingle" + "----------");
+ for (int j = 0; j < stores.size(); ++j) {
+ System.out.println(stores.get(j) + " ");
+ }
+
+ }
+
+ public static void printRank(ArrayList<Bicycle> stores) {
+ System.out.println("----------" + "printRank" + "----------");
+ for (int j = 0; j < stores.size(); ++j) {
+ System.out.println(stores.get(j) + " " + stores.get(j).calculatedDetails().getRank());
+ }
+
+ }
+
+
+
+
+@param stores
+@return <ArrayList<Bicycle>
+
+ public static ArrayList<ArrayList<Bicycle>> sortBikesByType(final ArrayList<ArrayList<Bicycle>> stores) {
+ ArrayList<ArrayList<Bicycle>> newStore = new ArrayList<ArrayList<Bicycle>>();
+
+ ArrayList<Bicycle> mountainBikes = new ArrayList<Bicycle>();
+ ArrayList<Bicycle> speedBikes = new ArrayList<Bicycle>();
+ ArrayList<Bicycle> childBikes = new ArrayList<Bicycle>();
+ System.out.println("---------- " + "grouping by bike type... " + " ----------");
+ for (int i = 0; i < stores.size(); ++i) {
+ for (int j = 0; j < stores.get(i).size(); ++j) {
+
+ Bicycle bike = stores.get(i).get(j);
+ if (bike instanceof ChildBike) {
+ childBikes.add(bike);
+ } else if (bike instanceof MountainBike) {
+ mountainBikes.add(bike);
+ } else if (bike instanceof SpeedBike) {
+ speedBikes.add(bike);
+ }
+ }
+ }
+
+
+
+ System.out.println("sorting...");
+ sortType(childBikes);
+ sortType(mountainBikes);
+ sortType(speedBikes);
+ System.out.println("sorted");
+
+
+
+ newStore.add(childBikes);
+ newStore.add(mountainBikes);
+ newStore.add(speedBikes);
+ return newStore;
+ }
+
+ private static void sortType(ArrayList<Bicycle> arrList) {
+ for (int x = 0; x < arrList.size(); ++x) {
+ for (int i = 0; i < arrList.size(); ++i) {
+ for (int j = i + 1; j < arrList.size(); ++j) {
+ int compare1 = arrList.get(i).calculatedDetails().getRank();
+ int compare2 = arrList.get(j).calculatedDetails().getRank();
+ if (compare1 < compare2) {
+ Bicycle tmp = arrList.get(i);
+ arrList.set(i, arrList.get(j));
+ arrList.set(j, tmp);
+ }
+ }
+ }
+ }
+ }
+
+ public static void print(Object[] arr) {
+ for (Object o : arr) {
+ System.out.println(o);
+ }
+ }
+
+ public static void print(Object[][] arr) {
+ for (int i = 0; i < arr.length; i++) {
+ System.out.println("---------- " + "printing row " + (i + 1) + " ----------");
+ print(arr[i]);
+
+ }
+ }
+
+
+
+
+@return
+
+ public Object[][] toArray() {
+ Object[][] arr = new Object[storesOfBikes.size()][];
+ for (int i = 0; i < storesOfBikes.size(); i++) {
+ arr[i] = storesOfBikes.toArray();
+ }
+ return arr;
+ }
+
+
+
+
+@param c
+@return
+
+ public boolean retainAll(Collection<Bicycle> c) {
+ boolean modified = false;
+ for (int i = storesOfBikes.size() - 1; i >= 0; i--) {
+ ArrayList<Bicycle> bikes = storesOfBikes.get(i);
+ for (int j = bikes.size() - 1; j >= 0; j--) {
+ Bicycle bike = bikes.get(j);
+ if (!c.contains(bike)) {
+ bikes.remove(j);
+ System.out.println("Removing " + bike);
+ modified = true;
+ }
+ }
+ }
+ System.out.println("Bikes to remove:");
+ printSingle((ArrayList<Bicycle>) c);
+ return modified;
+ }
+
+ public static void main(String[] args) {
+ BikeStores bikes = new BikeStores();
+
+ bikes.addBike(0, new SpeedBike(4, 3, 10, 40));
+ bikes.addBike(0, new SpeedBike(1, 2, 10, 30));
+ bikes.addBike(0, new MountainBike(1, 2, 3, 20));
+ bikes.addBike(0, new MountainBike(3, 2, 10, 25));
+ bikes.addBike(0, new ChildBike(false, 1, 1, 10));
+
+ bikes.addBike(1, new SpeedBike(10, 4, 10, 20));
+ bikes.addBike(1, new SpeedBike(0, 2, 10, 50));
+ bikes.addBike(1, new SpeedBike(3, 2, 10, 38));
+ bikes.addBike(1, new MountainBike(1, 3, 5, 44));
+ bikes.addBike(1, new ChildBike(true, 1, 1, 15));
+
+ bikes.addBike(2, new SpeedBike(7, 10, 20, 25));
+ bikes.addBike(2, new SpeedBike(0, 8, 40, 55));
+ bikes.addBike(2, new MountainBike(2, 3, 15, 33));
+ bikes.addBike(2, new MountainBike(1, 3, 15, 24));
+ bikes.addBike(2, new ChildBike(true, 1, 2, 20));
+ bikes.addBike(2, new ChildBike(false, 1, 1, 18));
+
+ bikes.removeBike(2, new ChildBike(true, 1, 2, 20));
+
+ print(bikes.storesOfBikes);
+
+ ArrayList<ArrayList<Bicycle>> sortedBikes = sortBikesByType(bikes.storesOfBikes);
+
+ System.out.println("SORTED BIKES");
+ print(sortedBikes);
+
+ System.out.println("ORIGINAL STORE ARRAYLIST");
+ print(bikes.storesOfBikes);
+
+ System.out.println("Testing retainAll();...");
+ Collection<Bicycle> c1 = new ArrayList<Bicycle>();
+ c1.add(new SpeedBike(0, 8, 40, 55));
+ c1.add(new ChildBike(false, 1, 1, 18));
+ Bicycle b1 = bikes.storesOfBikes.get(2).get(1);
+ Bicycle b2 = bikes.storesOfBikes.get(2).get(4);
+ Bicycle b3 = ((ArrayList<Bicycle>) c1).get(0);
+ Bicycle b4 = ((ArrayList<Bicycle>) c1).get(1);
+
+ System.out.println(b1.equals(b3) + " " + b2.equals(b4));
+ bikes.retainAll(c1);
+ print(bikes.storesOfBikes);
+
+ }
+
+}
+
+class {
+
+}
+
+
+
diff --git a/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/BikeStores.html b/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/BikeStores.html
new file mode 100644
index 0000000..c219a7d
--- /dev/null
+++ b/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/BikeStores.html
@@ -0,0 +1,298 @@
+
+
+
+BikeStores.java
+
+
+
+
+/home/caleb/ASDV-Java/Semester 2/Assignments/MP4_CalebFontenot/src/main/java/com/calebfontenot/mp4_calebfontenot/BikeStores.java |
+
+
+nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
+nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
+
+package com.calebfontenot.mp4_calebfontenot;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+
+
+@author
+
+public class BikeStores {
+
+ ArrayList<ArrayList<Bicycle>> storesOfBikes = new ArrayList<ArrayList<Bicycle>>();
+
+
+
+
+@param storeNumber
+@param b
+@return
+
+ public BikeStores() {
+ for (int i = 0; i < 3; i++) {
+ storesOfBikes.add(new ArrayList<Bicycle>());
+ }
+ }
+
+ public boolean addBike(int storeNumber, Bicycle b) {
+ if (storeNumber < 0 || storeNumber > this.storesOfBikes.size() - 1) {
+ return false;
+ }
+ if (b == null) {
+ return false;
+ }
+ System.out.println("Attempting to add " + b + " to store at index " + storeNumber);
+
+ ArrayList<Bicycle> bikesInInventory = storesOfBikes.get(storeNumber);
+ bikesInInventory.add(b);
+
+
+ storesOfBikes.set(storeNumber, bikesInInventory);
+ System.out.println("success!");
+ return true;
+ }
+
+
+
+
+@param storeNumber
+@param b
+@return
+
+ public boolean removeBike(int storeNumber, Bicycle b) {
+ if (storeNumber < 0 || storeNumber > this.storesOfBikes.size() - 1) {
+ return false;
+ }
+ if (b == null) {
+ return false;
+ }
+ System.out.println("Attempting to remove " + b + " to store at index " + storeNumber);
+
+ ArrayList<Bicycle> bikesInInventory = storesOfBikes.get(storeNumber);
+ bikesInInventory.remove(b);
+ System.out.println("success!");
+ return true;
+ }
+
+
+
+
+@param stores
+
+ public static void print(ArrayList<ArrayList<Bicycle>> stores) {
+ for (int i = 0; i < stores.size(); ++i) {
+ System.out.println("---------- " + "printing row " + (i + 1) + " ----------");
+ for (int j = 0; j < stores.get(i).size(); ++j) {
+ System.out.println(stores.get(i).get(j) + " ");
+
+ }
+ }
+ }
+
+ public static void printSingle(ArrayList<Bicycle> stores) {
+ System.out.println("----------" + "printSingle" + "----------");
+ for (int j = 0; j < stores.size(); ++j) {
+ System.out.println(stores.get(j) + " ");
+ }
+
+ }
+
+ public static void printRank(ArrayList<Bicycle> stores) {
+ System.out.println("----------" + "printRank" + "----------");
+ for (int j = 0; j < stores.size(); ++j) {
+ System.out.println(stores.get(j) + " " + stores.get(j).calculatedDetails().getRank());
+ }
+
+ }
+
+
+
+
+@param stores
+@return <ArrayList<Bicycle>
+
+ public static ArrayList<ArrayList<Bicycle>> sortBikesByType(final ArrayList<ArrayList<Bicycle>> stores) {
+ ArrayList<ArrayList<Bicycle>> newStore = new ArrayList<ArrayList<Bicycle>>();
+
+ ArrayList<Bicycle> mountainBikes = new ArrayList<Bicycle>();
+ ArrayList<Bicycle> speedBikes = new ArrayList<Bicycle>();
+ ArrayList<Bicycle> childBikes = new ArrayList<Bicycle>();
+ System.out.println("---------- " + "grouping by bike type... " + " ----------");
+ for (int i = 0; i < stores.size(); ++i) {
+ for (int j = 0; j < stores.get(i).size(); ++j) {
+
+ Bicycle bike = stores.get(i).get(j);
+ if (bike instanceof ChildBike) {
+ childBikes.add(bike);
+ } else if (bike instanceof MountainBike) {
+ mountainBikes.add(bike);
+ } else if (bike instanceof SpeedBike) {
+ speedBikes.add(bike);
+ }
+ }
+ }
+
+
+
+ System.out.println("sorting...");
+ sortType(childBikes);
+ sortType(mountainBikes);
+ sortType(speedBikes);
+ System.out.println("sorted");
+
+
+
+ newStore.add(childBikes);
+ newStore.add(mountainBikes);
+ newStore.add(speedBikes);
+ return newStore;
+ }
+
+ private static void sortType(ArrayList<Bicycle> arrList) {
+ for (int x = 0; x < arrList.size(); ++x) {
+ for (int i = 0; i < arrList.size(); ++i) {
+ for (int j = i + 1; j < arrList.size(); ++j) {
+ int compare1 = arrList.get(i).calculatedDetails().getRank();
+ int compare2 = arrList.get(j).calculatedDetails().getRank();
+ if (compare1 < compare2) {
+ Bicycle tmp = arrList.get(i);
+ arrList.set(i, arrList.get(j));
+ arrList.set(j, tmp);
+ }
+ }
+ }
+ }
+ }
+
+ public static void print(Object[] arr) {
+ for (Object o : arr) {
+ System.out.println(o);
+ }
+ }
+
+ public static void print(Object[][] arr) {
+ for (int i = 0; i < arr.length; i++) {
+ System.out.println("---------- " + "printing row " + (i + 1) + " ----------");
+ print(arr[i]);
+
+ }
+ }
+
+
+
+
+@return
+
+ public Object[][] toArray() {
+ Object[][] arr = new Object[storesOfBikes.size()][];
+ for (int i = 0; i < storesOfBikes.size(); i++) {
+ arr[i] = storesOfBikes.toArray();
+ }
+ return arr;
+ }
+
+
+
+
+@param c
+@return
+
+ public boolean retainAll(Collection<Bicycle> c) {
+ boolean modified = false;
+ for (int i = storesOfBikes.size() - 1; i >= 0; i--) {
+ ArrayList<Bicycle> bikes = storesOfBikes.get(i);
+ for (int j = bikes.size() - 1; j >= 0; j--) {
+ Bicycle bike = bikes.get(j);
+ if (!c.contains(bike)) {
+ bikes.remove(j);
+ System.out.println("Removing " + bike);
+ modified = true;
+ }
+ }
+ }
+ System.out.println("Bikes to remove:");
+ printSingle((ArrayList<Bicycle>) c);
+ return modified;
+ }
+
+ public static void main(String[] args) {
+ BikeStores bikes = new BikeStores();
+
+ bikes.addBike(0, new SpeedBike(4, 3, 10, 40));
+ bikes.addBike(0, new SpeedBike(1, 2, 10, 30));
+ bikes.addBike(0, new MountainBike(1, 2, 3, 20));
+ bikes.addBike(0, new MountainBike(3, 2, 10, 25));
+ bikes.addBike(0, new ChildBike(false, 1, 1, 10));
+
+ bikes.addBike(1, new SpeedBike(10, 4, 10, 20));
+ bikes.addBike(1, new SpeedBike(0, 2, 10, 50));
+ bikes.addBike(1, new SpeedBike(3, 2, 10, 38));
+ bikes.addBike(1, new MountainBike(1, 3, 5, 44));
+ bikes.addBike(1, new ChildBike(true, 1, 1, 15));
+
+ bikes.addBike(2, new SpeedBike(7, 10, 20, 25));
+ bikes.addBike(2, new SpeedBike(0, 8, 40, 55));
+ bikes.addBike(2, new MountainBike(2, 3, 15, 33));
+ bikes.addBike(2, new MountainBike(1, 3, 15, 24));
+ bikes.addBike(2, new ChildBike(true, 1, 2, 20));
+ bikes.addBike(2, new ChildBike(false, 1, 1, 18));
+
+ bikes.removeBike(2, new ChildBike(true, 1, 2, 20));
+
+ print(bikes.storesOfBikes);
+
+ ArrayList<ArrayList<Bicycle>> sortedBikes = sortBikesByType(bikes.storesOfBikes);
+
+ System.out.println("SORTED BIKES");
+ print(sortedBikes);
+
+ System.out.println("ORIGINAL STORE ARRAYLIST");
+ print(bikes.storesOfBikes);
+
+ System.out.println("Testing retainAll();...");
+ Collection<Bicycle> c1 = new ArrayList<Bicycle>();
+ c1.add(new SpeedBike(0, 8, 40, 55));
+ c1.add(new ChildBike(false, 1, 1, 18));
+ Bicycle b1 = bikes.storesOfBikes.get(2).get(1);
+ Bicycle b2 = bikes.storesOfBikes.get(2).get(4);
+ Bicycle b3 = ((ArrayList<Bicycle>) c1).get(0);
+ Bicycle b4 = ((ArrayList<Bicycle>) c1).get(1);
+
+ System.out.println(b1.equals(b3) + " " + b2.equals(b4));
+ bikes.retainAll(c1);
+ print(bikes.storesOfBikes);
+
+ }
+
+}
+
+class {
+
+}
+
+
+
diff --git a/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/ChildBike.html b/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/ChildBike.html
new file mode 100644
index 0000000..1c1caf5
--- /dev/null
+++ b/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/ChildBike.html
@@ -0,0 +1,84 @@
+
+
+
+ChildBike.java
+
+
+
+
+/home/caleb/ASDV-Java/Semester 2/Assignments/MP4_CalebFontenot/src/main/java/com/calebfontenot/mp4_calebfontenot/ChildBike.java |
+
+
+
+
+
+package com.calebfontenot.mp4_calebfontenot;
+
+
+
+@author
+
+public class ChildBike extends Bicycle
+{
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final ChildBike other = (ChildBike) obj;
+ System.out.println("Super returns: " + super.equals(obj));
+ return this.helpWheels == other.helpWheels && super.equals(obj);
+ }
+
+ private boolean helpWheels;
+
+ public ChildBike(boolean helpWheels, int cadence, int gear, int speed)
+ {
+ super(cadence, gear, speed);
+ this.helpWheels = helpWheels;
+ }
+
+ public boolean isHelpWheels()
+ {
+ return helpWheels;
+ }
+
+ public void setHelpWheels(boolean helpWheels)
+ {
+ this.helpWheels = helpWheels;
+ }
+
+ @Override
+ Details calculatedDetails()
+ {
+ return Details.getDetails(this);
+ }
+
+ @Override
+ public String toString()
+ {
+ return super.toString() + "ChildBike{" + "helpWheels=" + helpWheels + '}';
+ }
+
+}
+
+
+
diff --git a/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/Details.html b/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/Details.html
new file mode 100644
index 0000000..4d4f9fb
--- /dev/null
+++ b/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/Details.html
@@ -0,0 +1,81 @@
+
+
+
+Details.java
+
+
+
+
+/home/caleb/ASDV-Java/Semester 2/Assignments/MP4_CalebFontenot/src/main/java/com/calebfontenot/mp4_calebfontenot/Details.java |
+
+
+
+
+
+package com.calebfontenot.mp4_calebfontenot;
+
+
+
+@author
+
+public class Details {
+
+ private int rank;
+ private String info;
+
+ public int getRank()
+ {
+ return rank;
+ }
+
+ public String getInfo()
+ {
+ return info;
+ }
+
+ public static Details getDetails(Bicycle b)
+ {
+ Details d = new Details();
+ if (b instanceof SpeedBike) {
+ if (((SpeedBike) b).getWeight() < 1) {
+ d.rank = 10;
+ } else if (((SpeedBike) b).getWeight() > 1 && ((SpeedBike) b).getWeight() < 8) {
+ d.rank = 9;
+ } else {
+ d.rank = 0;
+ }
+ } else if (b instanceof MountainBike) {
+ if (((MountainBike) b).getSeatHeight() > 2) {
+ d.rank = 10;
+ } else {
+ d.rank = 0;
+ }
+ } else if (b instanceof ChildBike) {
+ if (((ChildBike) b).isHelpWheels()) {
+ d.rank = 10;
+ } else {
+ d.rank = 0;
+ }
+ } else {
+ return null;
+ }
+
+ d.info = b.toString();
+ return d;
+ }
+
+}
+
+
+
diff --git a/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/MountainBike.html b/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/MountainBike.html
new file mode 100644
index 0000000..d760041
--- /dev/null
+++ b/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/MountainBike.html
@@ -0,0 +1,86 @@
+
+
+
+MountainBike.java
+
+
+
+
+/home/caleb/ASDV-Java/Semester 2/Assignments/MP4_CalebFontenot/src/main/java/com/calebfontenot/mp4_calebfontenot/MountainBike.java |
+
+
+
+
+
+package com.calebfontenot.mp4_calebfontenot;
+
+
+
+@author
+
+public class MountainBike extends Bicycle
+{
+
+ private int seatHeight;
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final MountainBike other = (MountainBike) obj;
+ System.out.println("Super returns: " + super.equals(obj));
+ return this.seatHeight == other.seatHeight && super.equals(obj);
+ }
+
+ public MountainBike(int seatHeight, int cadence, int gear, int speed)
+ {
+ super(cadence, gear, speed);
+ this.seatHeight = seatHeight;
+ }
+
+ public int getSeatHeight()
+ {
+ return seatHeight;
+ }
+
+ public void setSeatHeight(int seatHeight)
+ {
+ this.seatHeight = seatHeight;
+ }
+
+ @Override
+ public String toString()
+ {
+ return super.toString() + " MountainBike{" + "seatHeight=" + seatHeight + '}';
+ }
+
+ @Override
+ Details calculatedDetails()
+ {
+ return Details.getDetails(this);
+ }
+
+}
+
+
+
+
diff --git a/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/SpeedBike.html b/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/SpeedBike.html
new file mode 100644
index 0000000..404d911
--- /dev/null
+++ b/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/SpeedBike.html
@@ -0,0 +1,94 @@
+
+
+
+SpeedBike.java
+
+
+
+
+/home/caleb/ASDV-Java/Semester 2/Assignments/MP4_CalebFontenot/src/main/java/com/calebfontenot/mp4_calebfontenot/SpeedBike.java |
+
+
+
+
+
+package com.calebfontenot.mp4_calebfontenot;
+
+
+
+@author
+
+public class SpeedBike extends Bicycle
+{
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 5;
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final SpeedBike other = (SpeedBike) obj;
+ System.out.println("Super returns: " + super.equals(obj));
+ return Double.doubleToLongBits(this.weight) == Double.doubleToLongBits(other.weight) && super.equals(obj);
+ }
+
+ private double weight;
+
+ public SpeedBike(double weight, int cadence, int gear, int speed)
+ {
+ super(cadence, gear, speed);
+ this.weight = weight;
+ }
+
+ public double getWeight()
+ {
+ return weight;
+ }
+
+ public void setWeight(double weight)
+ {
+ this.weight = weight;
+ }
+
+ @Override
+ public String toString()
+ {
+ return super.toString() + " SpeedBike{" + "weight=" + weight + '}';
+ }
+
+ @Override
+ Details calculatedDetails()
+ {
+ return Details.getDetails(this);
+ }
+
+
+}
+
+
+
diff --git a/Semester 2/Assignments/MP4_CalebFontenot/src/main/java/com/calebfontenot/mp4_calebfontenot/BikeStores.java b/Semester 2/Assignments/MP4_CalebFontenot/src/main/java/com/calebfontenot/mp4_calebfontenot/BikeStores.java
index 1ab881f..420b23b 100644
--- a/Semester 2/Assignments/MP4_CalebFontenot/src/main/java/com/calebfontenot/mp4_calebfontenot/BikeStores.java
+++ b/Semester 2/Assignments/MP4_CalebFontenot/src/main/java/com/calebfontenot/mp4_calebfontenot/BikeStores.java
@@ -228,8 +228,8 @@ public class BikeStores {
bikes.addBike(2, new SpeedBike(0, 8, 40, 55)); // retainAll should match this one
bikes.addBike(2, new MountainBike(2, 3, 15, 33));
bikes.addBike(2, new MountainBike(1, 3, 15, 24));
- bikes.addBike(2, new ChildBike(true, 1, 2, 20)); // retainAll should match this one
- bikes.addBike(2, new ChildBike(false, 1, 1, 18));
+ bikes.addBike(2, new ChildBike(true, 1, 2, 20));
+ bikes.addBike(2, new ChildBike(false, 1, 1, 18));// retainAll should match this one
//remove one child bike from store 2
bikes.removeBike(2, new ChildBike(true, 1, 2, 20)); // Java reuses the object created earlier since it has the same values.
//PRINT
@@ -246,7 +246,7 @@ public class BikeStores {
System.out.println("Testing retainAll();...");
Collection c1 = new ArrayList();
c1.add(new SpeedBike(0, 8, 40, 55));
- c1.add(new ChildBike(true, 1, 2, 20));
+ c1.add(new ChildBike(false, 1, 1, 18));
Bicycle b1 = bikes.storesOfBikes.get(2).get(1);
Bicycle b2 = bikes.storesOfBikes.get(2).get(4);
Bicycle b3 = ((ArrayList) c1).get(0);
diff --git a/Semester 2/ZIPs/MP4_CalebFontenot.zip b/Semester 2/ZIPs/MP4_CalebFontenot.zip
index 848c586..8bb2910 100644
Binary files a/Semester 2/ZIPs/MP4_CalebFontenot.zip and b/Semester 2/ZIPs/MP4_CalebFontenot.zip differ