add TODOs to lab03 + cleaner formatting

This commit is contained in:
SowinskiBraeden committed 2025-09-22 14:07:36 -07:00
1 parent 95139d77e5
commit 3e24aa6522
7 files changed
+75 -13

No files matched your search

+7 -11
View File
@@ -5,16 +5,12 @@
</component>
<component name="ChangeListManager">
<list default="true" id="4481728b-524b-48ee-9d70-e414a15f05bd" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/Creature.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/Creature.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/DamageException.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/DamageException.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/Dragon.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/Dragon.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/Elf.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/Elf.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/HealingException.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/HealingException.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/LowFirePowerException.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/LowFirePowerException.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/LowManaException.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/LowManaException.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/LowRageException.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/LowRageException.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/Orc.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/Orc.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IDevice.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IDevice.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPad.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPad.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPhone.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPhone.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPhone16.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPhone16.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPod.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPod.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/Main.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -119,7 +115,7 @@
<workItem from="1758413771974" duration="332000" />
<workItem from="1758425336799" duration="21000" />
<workItem from="1758473282464" duration="4563000" />
<workItem from="1758570032207" duration="2682000" />
<workItem from="1758570032207" duration="3338000" />
</task>
<servers />
</component>
@@ -5,9 +5,12 @@ package ca.bcit.comp2522.lab03;
* devices and common functionality.
*
* @author Braeden Sowinski
* @author Nicolas Agostini
* @author Trishaan Shetty
* @version 1.0.0
*/
public abstract class IDevice {
private final String purpose;
/**
@@ -15,6 +18,8 @@ public abstract class IDevice {
* @param purpose of IDevice
*/
public IDevice(final String purpose) {
// TODO: validate String inputs
this.purpose = purpose;
}
+21 -1
View File
@@ -5,9 +5,12 @@ package ca.bcit.comp2522.lab03;
* such as operating system version, and if it has a case.
*
* @author Braeden Sowinski
* @author Nicolas Agostini
* @author Trishaan Shetty
* @version 1.0.0
*/
public class IPad extends IDevice {
private final boolean hasCase;
private final String OSVersion;
@@ -22,6 +25,7 @@ public class IPad extends IDevice {
) {
super("learning");
// TODO: validate String inputs
this.hasCase = hasCase;
this.OSVersion = OSVersion;
}
@@ -39,6 +43,7 @@ public class IPad extends IDevice {
* and which operating system version it is running
*/
public void printDetails() {
final StringBuilder details;
details = new StringBuilder();
@@ -49,6 +54,7 @@ public class IPad extends IDevice {
details.append(this.OSVersion);
System.out.println(details.toString());
}
/**
@@ -57,7 +63,19 @@ public class IPad extends IDevice {
*/
@Override
public String toString() {
return super.toString() + " " + this.hasCase + " " + this.OSVersion;
final StringBuilder details;
details = new StringBuilder();
details.append(super.toString());
details.append(" ");
details.append(this.hasCase);
details.append(" ");
details.append(this.OSVersion);
return details.toString();
}
/**
@@ -68,6 +86,7 @@ public class IPad extends IDevice {
*/
@Override
public boolean equals(final Object o) {
// Ensure object exists
if (o == null) {
return false;
@@ -83,6 +102,7 @@ public class IPad extends IDevice {
otherIPad = (IPad) o;
return otherIPad.getOSVersion().equals(this.OSVersion);
}
/**
+14 -1
View File
@@ -5,9 +5,12 @@ package ca.bcit.comp2522.lab03;
* how many minutes remain on the phone plan.
*
* @author Braeden Sowinski
* @author Nicolas Agostini
* @author Trishaan Shetty
* @version 1.0.0
*/
public class IPhone extends IDevice {
private static final int IPHONE_HASH = 11;
private static final int IPHONE_HASH_CODE = 101;
@@ -25,6 +28,7 @@ public class IPhone extends IDevice {
) {
super("talking");
// TODO: validate String inputs, possibly other inputs too
this.remainingPhonePlanMinutes = remainingPhonePlanMinutes;
this.carrier = carrier;
}
@@ -42,6 +46,7 @@ public class IPhone extends IDevice {
* phone plan minutes
*/
public void printDetails() {
final StringBuilder details;
details = new StringBuilder();
@@ -52,6 +57,7 @@ public class IPhone extends IDevice {
details.append(")");
System.out.println(details.toString());
}
/**
@@ -60,10 +66,11 @@ public class IPhone extends IDevice {
*/
@Override
public String toString() {
// TODO: convert to StringBuilder, refer to IPad
return super.toString() + " " + this.remainingPhonePlanMinutes + " " + this.carrier;
}
/**
* equals check if a given IPhone has the same remaining
* phone plan minutes as this IPhone.
@@ -72,6 +79,7 @@ public class IPhone extends IDevice {
*/
@Override
public boolean equals(final Object o) {
// Ensure object exists
if (o == null) {
return false;
@@ -87,6 +95,7 @@ public class IPhone extends IDevice {
otherIPhone = (IPhone) o;
return otherIPhone.getRemainingPhonePlanMinutes() == this.remainingPhonePlanMinutes;
}
/**
@@ -95,8 +104,12 @@ public class IPhone extends IDevice {
*/
@Override
public int hashCode() {
int hash;
hash = IPHONE_HASH_CODE * IPHONE_HASH * (int) this.remainingPhonePlanMinutes;
return hash;
}
}
@@ -5,9 +5,12 @@ package ca.bcit.comp2522.lab03;
* features.
*
* @author Braeden Sowinski
* @author Nicolas Agostini
* @author Trishaan Shetty
* @version 1.0.0
*/
public class IPhone16 extends IPhone {
private static final int IPHONE_HASH_WITH_HIGH_RES = 103;
final boolean highResolutionCamera;
@@ -28,6 +31,8 @@ public class IPhone16 extends IPhone {
) {
super(remainingPhonePlanMinutes, carrier);
// TODO: validate memoryGB input?
this.highResolutionCamera = highResolutionCamera;
this.memoryGB = memoryGB;
}
@@ -46,6 +51,7 @@ public class IPhone16 extends IPhone {
*/
@Override
public String toString() {
final StringBuilder builder;
builder = new StringBuilder();
@@ -56,6 +62,7 @@ public class IPhone16 extends IPhone {
builder.append(this.memoryGB);
return builder.toString();
}
/**
@@ -67,6 +74,7 @@ public class IPhone16 extends IPhone {
*/
@Override
public boolean equals(final Object o) {
// Ensure object exists
if (o == null) {
return false;
@@ -88,6 +96,7 @@ public class IPhone16 extends IPhone {
matchingCameraResolution = this.highResolutionCamera && otherIPhone.getHighResolutionCamera();
return matchingMinutes && matchingCameraResolution;
}
/**
@@ -96,6 +105,7 @@ public class IPhone16 extends IPhone {
*/
@Override
public int hashCode() {
int hash;
hash = super.hashCode();
@@ -105,5 +115,6 @@ public class IPhone16 extends IPhone {
}
return hash;
}
}
+15
View File
@@ -5,9 +5,12 @@ package ca.bcit.comp2522.lab03;
* volume in decibels.
*
* @author Braeden Sowinski
* @author Nicolas Agostini
* @author Trishaan Shetty
* @version 1.0.0
*/
public class IPod extends IDevice {
private static final int IPOD_HASH = 7;
private static final int IPOD_HASH_CODE = 97;
@@ -25,6 +28,8 @@ public class IPod extends IDevice {
) {
super("music");
// TODO: validate numberOfSongs input
this.numberOfSongs = numberOfSongs;
this.maxVolumeDecibels = maxVolumeDecibels;
}
@@ -34,6 +39,7 @@ public class IPod extends IDevice {
* and max volume in decibels.
*/
public void printDetails() {
final StringBuilder details;
details = new StringBuilder();
@@ -44,6 +50,7 @@ public class IPod extends IDevice {
details.append(" dB.");
System.out.println(details.toString());
}
/**
@@ -60,6 +67,8 @@ public class IPod extends IDevice {
*/
@Override
public String toString() {
// TODO: change this to StringBuilder, refer to IPad
return super.toString() + " " + this.numberOfSongs + " " + this.maxVolumeDecibels;
}
@@ -71,6 +80,7 @@ public class IPod extends IDevice {
*/
@Override
public boolean equals(final Object o) {
// Ensure object exists
if (o == null) {
return false;
@@ -86,6 +96,7 @@ public class IPod extends IDevice {
otherIPod = (IPod) o;
return otherIPod.getNumberOfSongs() == this.numberOfSongs;
}
/**
@@ -94,8 +105,12 @@ public class IPod extends IDevice {
*/
@Override
public int hashCode() {
int hash;
hash = IPOD_HASH_CODE * IPOD_HASH + this.numberOfSongs;
return hash;
}
}
@@ -4,6 +4,8 @@ package ca.bcit.comp2522.lab03;
* Main class to test IDevice classes, and abstract concepts.
*
* @author Braeden Sowinski
* @author Nicolas Agostini
* @author Trishaan Shetty
* @version 1.0.0
*/
public class Main {