Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 You are given a list of all the transactions on a bank account during the year 2 0 2 0 . The account was

2You are given a list of all the transactions on a bank account during the year2020. The account was empty at the beginning of the year (the balance was 0).Each transaction specifies the amount and the date it was executed. If the amount is negative (less than 0) then it was a card payment, otherwise it was an incoming transfer (amount at least 0). The date of each transaction is in YYYY-MM-DD format: for example, 2020-05-20 represents 20th May 2020.Additionally, there is a fee for having a card (omitted in the given transaction list), which is 5 per month. This fee is deducted from the account balance at the end of each month unless there were at least three payments made by card for a total cost of at least 100 within that month.Your task is to compute the final balance of the account at the end of the year 2020.Write a function:class Solution { public int solution(int|] A, String||D): }that, given an array A of N integers representing transaction amounts and an array D of N strings representing transaction dates, returns the final balance of the account at the end of the year 2020. Transaction number K (for K within the range [O..N-1) was executed on the date represented by D[K] for amount AIK.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions