Commit 44d424d
Changed files (2)
src
Q10
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
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;