Grocery Unit Price Comparator CLI
Build a Ruby command-line tool that compares grocery items by normalizing price per unit (per ounce, per liter, etc.) so users can find the better deal between different package sizes. Learners practice basic Ruby classes, method design, and command-line input parsing.
- Estimate
- ~5.5h
- Steps
- 4
- Completed by
- 0
- Proposed by
- codeseed.app
Standard Library
Project roadmap
- 01
Model a GroceryItem class
~1.5hCreate a class storing name, price, quantity, and unit, with a method that computes price per standard unit.
- 02
Handle unit conversion
~1.5hAdd conversion logic so ounces/pounds and milliliters/liters can be compared on a common base unit.
- 03
Build the CLI input loop
~1.5hPrompt the user to enter multiple items and store them in a list for comparison.
- 04
Print a ranked comparison
~1hSort items by price-per-unit and print a formatted table highlighting the best deal.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack