Lab 5 — ATM Transactions
Adapt from https://pages.github.khoury.northeastern.edu/2500/2024F/lab/lab9.html
Introduction
In this lab, you'll work with a dataset of ATM transactions and practice using list operations to analyze this data. Each transaction includes information such as: account ID, type of transaction (withdrawal, deposit, or transfer), transaction amount, date, location, and balance after transaction.
Problem 1
Extract the "amount" column from the transactions table and use it to answer the following questions:
a) What is the total amount of all transactions?
b) What is the average transaction amount?
c) What is the largest transaction amount?
d) What is the smallest transaction amount?
Problem 2
Create a function called is-withdrawal
that takes a transaction type as input and returns true if it's a withdrawal. Then, use this function with filter to get a list of all withdrawal amounts from the transaction data and define a constant TOTAL-WITHDRAWAL
that stores the total amount withdrawn.
Problem 3
Extract the "location" column from the transactions table, then use the distinct
function to find all unique ATM locations where transactions occurred.
Define a constant NUM-UNIQUE-LOCATIONS
to store how many unique locations there are.
Problem 4
Write a function transaction-description
that takes a row from the transactions table and returns a string describing the transaction in the following format: "[account] [type] $[amount] at [location] on [date]". Then, use map
to create a list of transaction descriptions for all transactions.