Student Grade Statistics Tool
Build a Scala command-line tool that reads a CSV file of student scores and prints a statistics report: the average, median, mode, highest and lowest score, the standard deviation, and how many students got each letter grade, shown as a small bar chart in the terminal. It handles messy files gracefully, reporting rows with missing or invalid scores instead of crashing. It's a good first Scala project: you'll learn case classes, reading CSV with scala-csv, immutable collections and higher-order functions (map, filter, foldLeft and groupBy), Option and Either for handling bad data, and testing with munit or ScalaTest.
- Estimate
- ~6.5h
- Steps
- 5
- Completed by
- 0
- Proposed by
- codeseed.app
sbt · scala-csv
Project roadmap
- 01
Read the CSV
~1.5hCreate an sbt project with scala-csv and a test library. Write a case class StudentScore(name, score) and a function that reads the file given as an argument with CSVReader and turns each row into Either[String, StudentScore], where Left explains the problem (missing name, score not a number, score outside 0 to 100) with the line number. Done when: a sample file with some bad rows gives the right valid records and error messages.
- 02
Compute the statistics
~1.5hWrite pure functions: mean with foldLeft, median (sorting, and averaging the two middle values for an even count), mode (with groupBy, returning every value tied for most common), minimum, maximum and standard deviation. Return Option, so an empty list gives None instead of an error. Done when: the functions give correct results for small lists you can check by hand.
- 03
Count letter grades
~1hMap each score to a letter grade (for example A for 90 and above, B for 80 to 89, down to F), with the bands defined in one place, then count students per grade with groupBy, including grades nobody got (shown as 0). Done when: the counts add up to the number of valid students.
- 04
Print the report
~1hPrint the statistics with 2 decimals, the grade distribution as a bar chart made of # characters, the top 3 students, and the list of skipped rows with their reasons. Align everything in columns. Done when: the report is easy to read, and every number matches the data.
- 05
Test it
~1.5hWrite tests for each statistic (including even and odd counts, a single score, and ties for the mode), grade boundaries (89.9, 90 and 100), the empty list, and parsing rows with every kind of problem. Done when: sbt test passes.
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack