Skip to content
AgileLogics
Intermediate 5 min read

Intermediate Projects

Prerequisites: Level 2 — Intermediate

Build these using case classes, traits, enums, pattern matching, for-comprehensions, Either, files, and tests from Level 2.

1. Expense Tracker

Model expenses as case classes with an enum category. Load them from a CSV file, validate each line into an Either[String, Expense], report invalid lines, and print totals per category and month.

2. Library Management

Model books, members, and loans with case classes and a sealed trait for events (borrowed, returned, overdue). Keep state immutable — each operation returns a new state — and cover the rules with MUnit tests.

3. Expression Evaluator

Define an algebraic data type for arithmetic expressions (numbers, variables, +, *, /), evaluate it with pattern matching against a Map of variables, and return Either errors for unknown variables and division by zero.

4. Command-Line To-Do App

Build a to-do app run with Scala CLI that stores items in a JSON file, with commands to add, complete, list, and filter tasks. Parse arguments with pattern matching on the argument list.