You’re asked to write a program to analyze (or report) acustomer’s credit card’s monthly purchase transactions. The programis to read all customer’s transactions from a text file and storethem in an array of transactions. A transaction can be a Bankingtransaction, or a Department Store transaction, or a Grocerytransaction. Each transaction may qualify for reward points. Inother word a transaction is rewardable. The program will buildanother array of Rewardable objects which are in fact thetransactions objects themselves. Finally the program will generatetwo reports: one is to list all transactions and the other is toproduce a summary report of reward points for the customer. Thebelow diagram shows how the arrays of Transactions and arrays ofRewardable look like: Transaction and Rewardable Arrays Theassignment basically illustrates the following concepts:Inheritance Abstract classes Polymorphism instanceof InterfacesClass Design You need to have at least the following classesdescribed below. Feel free to come up with more classes if needed.public class CreditCardTransactionAnalyzer This class is the publicclass containing the main method The main method should do thefollowing: Instantiate a Customer object using non-defaultconstructor Invoke readTransactions Invoke reportTransactionsInvoke reportCharges Invoke reportRewardSummary class Customer(minimum implementation specified below) Private instance fieldsCustomer name Credit card number (16-digit String) Transactionbalance (total balance) Reward points balance Array of referencesto Transaction objects (size 16 – use private static constantinteger field – initialized to 16) Array of references toRewardable objects (size 16 – see above) Public Constructors:default and non-default constructors similar to previousassignments (setting total balance to 0.0 and reward points balanceto 1000 by default) Public instance methods: readTransactions: reada text file containing Transactions with format shown below. Basedon transaction type (GS, BK, or DS) instantiate the correct subclass object and assign it to the array of Transactions Each subclass object can potentially be a Rewardable object (Grocery andDepartment Store). Use instanceof to determine if that’s the casethen assign it to the array of Rewardable object. Note that you donot isntantiate new objects for the Rewardable array. It simplymake references to the array of Transaction objects (see diagramabove) NOTE: The array of Rewardable objects will have lessnon-null objects than the Transaction array. Text file format: (youmust create a text file containing exactly 16 transactions)DS~04/23/18~1111~25.67~Macys~60 BK~03/12/18~2222~300.0~ATM~6.00GR~04/20/18~4444~57.95~Lucky BK~05/01/18~5555~100.0~CASH~4.00<<<<<< withdraw $100, service charge $4.00GR~04/23/18~6666~17.39~Safeway DS~04/01/18~7777~211.67~Sears~90NOTE: DS: Department Store transaction BK: Banking transaction GR:Grocery transaction reportTransactions (this is genericallyprocessing): invoke the list method for each Transaction in theTransaction array. This should list all transactions’ information.Must use the new for loop syntax. TRANSACTION LISTING REPORT04/23/18 Department Store Macys $ 25.67 (return in 60 days)03/12/18 Banking ATM withdraw $306 04/20/18 Grocery Lucky $57.95etc … reportCharges (this is specifically processing): go thruthe entire Transaction array. If a transaction is a Banking onethen compute the total charges and then display it. Simply displayone line: Total charges: $XYZ reportRewardSummary (this is processobjects implementing the same interface) : invoke the earnPoints tocompute total points for different transaction category from theRewardable array to prepare the report summary below. Must use thenew for loop syntax Rewards Summary for Previous points balance1000 + Points earned on Department store purchases: 2710 + Pointsearned on Grocery Stores purchases 750———————————————————————————-= Total points available for redemption 4460 class Transaction:this is an abstract class Private instance field: transaction idProtected instance fields: transaction date (mm/dd/yy), transactionamount Public Constructors Public instance methods: list: abstractmethod returning a String of transaction information (seeTRANSACTION LISTING REPORT sample). This abstract method will beimplemented in the sub classes. toString: output transaction id,transaction date, and transaction mount equals: same transaction idand same date accessors/mutators NOTE: No transaction type instancefield should be defined for any class, super class or sub classes.Point deduction will apply if that’s the case. Sub classes fromTransaction: DepartmentStoreTransaction: department name (Macys,Ross, Marshall, …), return policy (30 days, 60 days, or 90 days)BankingTransaction: type (ATM withdraw or CASH withdraw), chargeGroceryTransaction: store name (Lucky, Walmart, Safeway, ..), Keepthose sub classes simple.Those sub classes will implementRewardable interface as appropriate. Not all of them will. Atminimum they should have the following: private instance fieldspublic default and non-default constructors (must explicitly useconstructor chaining) Note: The non-default constructors of thosesub classes must take transaction date, transaction id, transactionamount (required by the superclass’ non-default constructor) inaddition to parameters required by their own instance field.accessor/mutator toString and equals: for overloading equals mustcombine with the super class equals method using && logicaloperator Provide implementation for the listing abstract method inthe Transaction super class to display a transaction in thefollowing format: Date Transaction type Amount Specific info abouttransaction Example: 03/12/16 Banking ATM withdraw $306 Note:listing for Banking transaction must add the charge to amountInterface Design Provide an interface namely Rewardable with onlyone method: earnPoints that computes and returns total pointsearned for a particular transaction according to the followingrules: DepartmentStoreTransaction: 3 points per $1GroceryTransaction: 5 points per $1 NOTE: Unrelated objectsimplement the same interface can be grouped together and processedthe same way (via the interface’s “contractual obligation”). Inthis assignment we don’t really demonstrate that capability. TheTransaction objects that implement Rewardable interface are in factrelated (within Transaction inheritance hierarchy). You may thinkin real life there could be other unrelated classes that can earnpoints such as MerchandiseAccount, FrequentFlyerAccount, etc… andthus they will need to implement Rewardable interface. In that casewe can group MerchandiseAccount, FrequentFlyerAccount,GroceryTransaction, DepartmentStoreTransaction altogether asRewardable objects and compute their reward points. Just somethingfor you to think about.
To place your order, you need to fill in the order form form with all the requisite details. Once you submit your requirements, we assign a professional essay writer who owes expertise in your subject area to start working on your request and deliver your assignment on time.
Phone: +1 (234) 295-3084