Recommend this page to a friend! |
Classes of Maniruzzaman Akash | PHP Commission Calculator From CSV File | problem.MD | Download |
|
DownloadSituationA payment gateway services allows private and business clients to You have to create an application that handles operations provided in CSV format and calculates a commission fee based on defined rules. Commission fee calculation
Deposit ruleAll deposits are charged 0.03% of deposit amount. Withdraw rulesThere are different calculation rules for Private Clients - Commission fee - 0.3% from withdrawn amount. - 1000.00 EUR for a week (from Monday to Sunday) is free of charge. Only for the first 3 withdraw operations per a week. 4th and the following operations are calculated by using the rule above (0.3%). If total free of charge amount is exceeded them commission is calculated only for the exceeded amount (i.e. up to 1000.00 EUR no commission fee is applied). For the second rule you will need to convert operation amount if it's not in Euros. Business Clients - Commission fee - 0.5% from withdrawn amount. Input dataOperations are given in a CSV file. In each line of the file the following data is provided:
1. operation date in format Expected resultOutput of calculated commission fees for each operation. In each output line only final calculated commission fee for a specific operation must be provided without currency. Example usage
Note: the example output is calculated base on the following exchange rates: EUR:USD - 1:1.1497, EUR:JPY - 1:129.53. |