Question: Use the Account and CDAccount classes you created from Assignment 6 (Class Inheritance) Add an overridden equals(Object) method in Account class - if two Account

  • Use the Account and CDAccount classes you created from Assignment 6 (Class Inheritance)
  • Add an overridden equals(Object) method in Account class - if two Account objects with the same ID number return true.
  • Create 100 Account or CDAccount objects randomly, and store in an Account ArrayList. (Account ID from 1001~1100 and generate the initial balance and CDAccount period randomly)
  • Call java.util.Collections.shuffle(ArrayList) to mix up the order of objects in the Account ArrayList.

  • Prompt (console screen or GUI) to the user to provide account numbers and search for the specific objects from the Account ArrayList(Refer to the sample output). ** DON'T use a for-loop to search for the object with matched account id, instead, using contains() or indexof() methods from the ArrayList to find the matched object.
  • For Account objects, print out the account ID and balance (use getID() and getBalance() methods); for CDAccount objects, print out the account number, account type, and mature balance (use getMatureBalance()); for account number cant be found, print out The Account Number doesnt existed!!

** It is NOT allowed to call toString() method to display the account information. You need to use instanceof operator to check the type of account before invoking the corresponding methods to display the account information.

  • Submit your source codes (Account.java, CDAccount.java, and Assignment7.java), and the screenshot of test run.
  • Comment your name and ID in the first line of each source file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!