hantsy / code-challenges

Code challenges in learning new languages, frameworks, engineering tools, architectures, software design patterns, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code Challenges in ...

In the past years, I am always trying to update myself to the cutting-edge technologies. I defined a lot of learning paths or coding journeys to archive the purpose. I also tried to participate into some programs in Twitter hashtags, such as #100DaysofCode to track my work. Finally I found most of them didn't work as expected due to the progress disturbed by some uncertain things in my life.

Personally I hope this repository will record some of my learning results in the future.

This repository is not for showing you how to learn something or teaching you some new things. It is just my toys, it is truely coding for fun. I will not follow the rules of any campaigns. In another words, I will add the work at my pace. There is no deadlines or limitations like delivering a real world project.

Transaction Analyzer

The Transaction Analyzer application is use for loading transaction records from an existing CSV files and generating statistics report after analyzing the loaded data.

Requirements

Given a CSV file contains some transaction records from a financial system, design an application to analyze the data in the CSV file and generate a statistics report.

When analyzing the records, the REVERSAL transaction and it related transaction should be excluded.

Assume there is a CSV example file contains the following transactions.

ID, Date, Amount, Merchant, Type, Related Transaction
WLMFRDGD, 20/08/2020 12:45:33, 59.99, Kwik-E-Mart, PAYMENT,
YGXKOEIA, 20/08/2020 12:46:17, 10.95, Kwik-E-Mart, PAYMENT,
LFVCTEYM, 20/08/2020 12:50:02, 5.00, MacLaren, PAYMENT,
SUOVOISP, 20/08/2020 13:12:22, 5.00, Kwik-E-Mart, PAYMENT,
AKNBVHMN, 20/08/2020 13:14:11, 10.95, Kwik-E-Mart, REVERSAL, YGXKOEIA
JYAPKZFZ, 20/08/2020 14:07:10, 99.50, MacLaren, PAYMENT,

When user input the following arguments as query criteria.

fromDate: 20/08/2020 12:00:00
toDate: 20/08/2020 13:00:00
merchant: Kwik-E-Mart

It should output the result similar to this.

Number of transactions = 1
Average Transaction Value = 59.99

If no transaction record found, print the following message instead.

No transactions found.

My implemenation Examples

To make things simpler, I tried to avoid to use any third party library to parse the CSV file, and also didn't adopt a database to store the parsed data from CSV, all the analyzing work is done in memory.

As as a toy for myself, I've created a collection of implementations written in different languages and techniques.

Example Description
java Java examples
java-ddd (Working in progress) Java with DDD/Onion/Hexagon Architecture
java-fn Java Functional Programming(Function, Supplier, Consumer, CompletableFuture)
kotlin Kotlin
scala Scala
php PHP
csharp C#
node-typescript Node(Typescript)
go Go

More ...

Desire to dive deeper in more Kotlin examples, check the following projects which used Kotlin with the cool Spring support, including Kotlin Coroutines and Kotlin DSL.

Want to explore an example close to real world applications with testing codes and CI/CD integrations. Check the following example which is configured with most the popluar CI service, including Github Actions, Travis, Circle, Codefresh, Drone, SemaphoreCI, Appveyor, Shippable, etc.

Feel tired with frameworks and return back to Java EE/Jakarta EE, it is also great. Check the following template projects to start your Jakarta EE application development freely. These projects include sample test codes and configurations with Arquillian against the popluar application servers, such as WildFly, Payara/Glassfish, Open Liberty, Apache TomEE, etc.

Enjoy!

About

Code challenges in learning new languages, frameworks, engineering tools, architectures, software design patterns, etc.

License:Apache License 2.0


Languages

Language:Java 33.4%Language:Scala 14.0%Language:PHP 10.9%Language:C# 10.5%Language:Kotlin 10.1%Language:TypeScript 10.1%Language:JavaScript 6.9%Language:Go 4.0%