/phone-company-exercise

Quick example on how to use Cats.IO effects and pure functions to calculate costs of customers on their phone bill

Primary LanguageScala

Phone Company

Each day at The Phone Company a batch job puts all the customer calls for the previous day into a single log file of:

'customer id','phone number called','call duration'

For a customer the cost of a call up to and including 3 minutes in duration is charged at 0.05p/sec, any call over 3 minutes in duration the additional time is charged at 0.03p/sec. However, there is a promotion on and the calls made to the phone number with the greatest total cost is removed from the customer's bill.

Exercise

Parse the calls.log file and print out the total cost of calls for the day for each customer.