package eecs2030.test4; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * A bill that includes an itemized list of purchased items. * The itemized bill and its list form a composition. The total * price of the bill is guaranteed to be equal to the sum * of the prices of the items in the bill. * * @author EECS2030 Fall 2016-17 * */ public class ItemizedBill extends Bill { // ADD YOUR FIELDS HERE /** * Initialize this bill from a list of purchased items. The total * price of the bill is computed as the sum of the prices of the * purchased items. The date of issue is the current date. * * @param items a list of purchased items */ public ItemizedBill(List items) { } /** * Initialize this bill by copying another bill. The total * price of the bill, the date of issue, and * the list of items purchased are all copied from the * other bill. * * @param other the bill to copy */ public ItemizedBill(ItemizedBill other) { } /** * Returns the list of items purchased for this bill. * The returned list cannot be used to modify this bill. * * @return the list of items purchased for this bill */ public List getItems() { } /** * Add an item to the list of items purchased for this bill. * The total price of the bill is updated to include the price * of the added item. * * @param item add an item to the list of items purchased for this bill */ public void addItem(Item item) { } /** * Returns the sorted list of items purchased for this bill. * Items are sorted as specified in Item.compareTo. * * @return the sorted list of items purchased for this bill */ public List getSortedItems() { List it = this.getItems(); Collections.sort(it); return it; } /** * Returns a hash code for this bill. The hash code is equal to the * hash code returned by the superclass Bill. * * @return a hash code for this bill * @see eecs2030.test4.Bill#hashCode() */ @Override public int hashCode() { } /** * Compares two itemized bills for equality. The result is true if and only if the * argument is not null and is an ItemizedBill object that has: * *
    *
  • the same total price as this itemized bill *
  • the same date of issue as this itemized bill *
  • the same list of items purchased ignoring the order in which * items appear in the list *
* *

* equals does not modify the list of items in this bill. * * @param obj the object to compare this item against * @return true if the given object represents an ItemizedBill equivalent to this * bill, false otherwise * @see eecs2030.test4.Bill#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { } }