Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

JAVA

I need answer for this JAVA homework.

It must be done in 8 hours from now. And please follow the details and read them carefuly. I uploaded a zip file so you can look at it. 

DataAbstraction: 

  1. Implement the Comparable interface in the Transaction.java super class. Sort first by participantID and then by tranID if the participantID’s are the same.
  2. Complete the two subclasses - InvoiceItem.java (extends ‘Item’) and Invoice.java (extends ‘Transaction’) Completion of the subclass InvoiceItem includes: 
  • *  Adding an instance variable 'ouncesPerUnit' as an int
  • *  Adding a constructor. Parameters are:

o int itemID,o String description,o double price,o int quantityOrdered, o int ouncesPerUnit 

  • *  Adding a ‘changeInventory()’ method to override the abstract method in ‘Item’ This method creates a String that reports the processing that would take place. See example output in output.txt.
  • *  Adding an override of the inherited 'toString()' method. Return 'toString' from Item class plus the ounces per unit. See example output in output.txt.
  • Completion of the subclass Invoice includes:
  • *  Adding an instance variable 'isPaid 'as type boolean
  • *  Adding a constructor. Parameters are:

o int tranID (note 'tranID' is private to the Item class.) 

o int customer,o boolean isPaid 

*Adding an ‘addItem()’ method. The method creates a new InvoiceItem object and adds it to the ArrayList inherited from the Transaction class. – See Transaction.java. Parameters are: 

o int itemID,o String desc, 

o double price, 

o int qty,o int ounces 

*Adding an override of the toString() method. Return 'tranID' from Transaction, 'isPaid' and and a listing of InvoiceItems. See example output in output.txt. 

Note the ‘tranID’ instance variable in Transaction must be kept private so you will have to access it through calls to the super class constructor and the super class toString methods. 

Execution of the Tester.java should produce the output shown in the output file. NOTE: Do not attempt to modify Tester.java. To turn in: Print your .java files and submit on paper, in class 

Thank you.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question