summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormokha <mokha@cisco.com>2019-05-07 09:07:51 -0600
committermokha <mokha@cisco.com>2019-05-07 09:07:51 -0600
commit44d424d22ddcd267dc5d4612f028f7aa4fb4fab3 (patch)
tree67106800d6587b8c44a6b369930c40a1a1c78f28 /src
parent1f88dcd4120787c55933607c3280e880f5ff00db (diff)
add more documentation
Diffstat (limited to 'src')
-rw-r--r--src/Q1/AddressBook.java24
-rw-r--r--src/Q10/TaxReturn.java20
2 files changed, 30 insertions, 14 deletions
diff --git a/src/Q1/AddressBook.java b/src/Q1/AddressBook.java
index d08fad1..ad04a9a 100644
--- a/src/Q1/AddressBook.java
+++ b/src/Q1/AddressBook.java
@@ -1,6 +1,7 @@
/**
- * Assignment 1, COMP268 Class: AddressBook.java Purpose: Represents a contact from an address book.
+ * Assignment 1, COMP268 Class: AddressBook.java
*
+ * @description Represents a contact from an address book.
* @author: mo khan Student ID: 3431709
* @date May 6, 2019
* @version 1.0
@@ -268,10 +269,9 @@ public class AddressBook implements Comparable<AddressBook> {
}
/**
- * Compares name1 with name2 and returns a string representation.
- * Returns a negative value if name1 is less than name2.
- * Returns a positive value if name1 is greater than name2.
- * Returns a zero if name1 is equal to name2.
+ * Compares name1 with name2 and returns a string representation. Returns a negative value if
+ * name1 is less than name2. Returns a positive value if name1 is greater than name2. Returns a
+ * zero if name1 is equal to name2.
*
* @param name1 first name
* @param name2 second name
@@ -282,10 +282,9 @@ public class AddressBook implements Comparable<AddressBook> {
}
/**
- * Compares one address book with another.
- * Returns a negative value if this is less than other.
- * Returns a positive value if this is greater than other.
- * Returns a zero if this is equal to other.
+ * Compares one address book with another. Returns a negative value if this is less than other.
+ * Returns a positive value if this is greater than other. Returns a zero if this is equal to
+ * other.
*
* @param other The other address book to compare to.
*/
@@ -296,11 +295,9 @@ public class AddressBook implements Comparable<AddressBook> {
}
/**
- * Overrides equals to check for value equality instead of
- * reference equality.
+ * Overrides equals to check for value equality instead of reference equality.
*
* @param o The other item to check against.
- *
* @return true if values match, otherwise false.
*/
@Override
@@ -321,8 +318,7 @@ public class AddressBook implements Comparable<AddressBook> {
}
/**
- * Overrides hashCode to ensure instances that are
- * equal by value equate to the same hash code for
+ * Overrides hashCode to ensure instances that are equal by value equate to the same hash code for
* hash key computations.
*
* @return The hash code
diff --git a/src/Q10/TaxReturn.java b/src/Q10/TaxReturn.java
index ceda632..7a9e32a 100644
--- a/src/Q10/TaxReturn.java
+++ b/src/Q10/TaxReturn.java
@@ -1,3 +1,11 @@
+/**
+ * Assignment 1, COMP268 Class: TaxReturn.java
+ *
+ * @description Represents a contact from an address book.
+ * @author: mo khan Student ID: 3431709
+ * @date May 6, 2019
+ * @version 1.0
+ */
package Q10;
import java.util.Scanner;
@@ -17,6 +25,13 @@ public class TaxReturn {
this(income, status, 0);
}
+ /**
+ * Constructs a TaxReturn object for a given income and marital status and, and # of children.
+ *
+ * @param income the taxpayer income
+ * @param status either SINGLE or MARRIED
+ * @param children the number of children
+ */
public TaxReturn(double income, int status, int children) {
this.income = income;
this.status = status;
@@ -24,6 +39,11 @@ public class TaxReturn {
if (this.isSingle()) this.income -= children * 5000;
}
+ /**
+ * Returns the calculated taxes to pay.
+ *
+ * @return the amount of tax to pay.
+ */
public double getTax() {
double tax = 0;