Question: answer this question in Java and only if you are fully confident of the answer. The code should work without any errors. These are not
answer this question in Java and only if you are fully confident of the answer. The code should work without any errors. These are not stocks, but transactions that have occurred. Cashback value can be calculated using amount (third item on each transaction) * cashback value for respective company. The final item for each transaction is the date the transaction occurred in the format mm-dd-yyyy.
Data for question:
Transaction:
[ ["PURCHASE", "Starbucks", 100, 02152022], ["PURCHASE", "Starbucks", 10, 02162022], ["PURCHASE", "Amazon", 15, 02122022], ["PURCHASE", "Walmart", 30, 03192022], ["REFUND", "Walmart", 30, 03202022], ]
Cashback value:
[ ["Starbucks", 0.1], ["Amazon", 0.2], ["Walmart", 0.01], ]
Question:
i) Store the transaction list as a heap and the cashback value list as a hashmap
ii) Calculate the top cashback value for the month "02" (FEB)
Example output: 3 (since 15*0.2 > 10*0.1) for transactions that occurred in the month "02"
Step by Step Solution
3.48 Rating (168 Votes )
There are 3 Steps involved in it
Heres a Java code that addresses the given question import javautil class Transaction String type St... View full answer
Get step-by-step solutions from verified subject matter experts
