Unit & Currency Converter Console App
Build a menu-driven converter in C# for the console: choose a category (length, weight, temperature or currency), pick the units to convert between, type a value, and see the result, with a short history of your recent conversions. Currency uses a fixed table of exchange rates stored in the program (with the date they're from), and impossible conversions are simply not offered. It's a good first C# project: you'll learn enums, switch expressions, dictionaries, reading and validating console input, formatting numbers, and organizing code into small classes you can test.
- Estimate
- ~7.5h
- Steps
- 6
- Completed by
- 0
- Proposed by
- codeseed.app
.NET CLI
Project roadmap
- 01
Define categories and units
~1hCreate a project with dotnet new console. Define an enum Category and, for each category, the list of units (for example meters, kilometers, miles and feet for length) with their display names and symbols. Keep the unit data in one place. Done when: the program can list every category and its units.
- 02
Write the conversion logic
~1.5hWrite a Converter class: for length and weight, convert through a base unit using a dictionary of factors; for temperature, use a switch expression over the (from, to) pair with the formulas for Celsius, Fahrenheit and Kelvin, refusing values below absolute zero. Use decimal for precise results. Done when: 5 km to miles gives 3.107, and 100 °C to °F gives 212.
- 03
Add currencies
~1hAdd a static dictionary of exchange rates relative to EUR for at least 6 currencies, with a constant for the date the rates are from. Convert through EUR and round to 2 decimals. Show the rates' date with every currency result. Done when: currency conversions are correct in both directions.
- 04
Build the menu
~1.5hBuild a loop: choose a category by number, then the source and target units (only from that category, so impossible pairs can't be picked), then enter a value, parsed with decimal.TryParse using the invariant culture. Re-ask on invalid input with a clear message, and allow going back or quitting at any step. Done when: every path through the menu works, and bad input never crashes the program.
- 05
Format results and keep a history
~1hShow results like 5 km = 3.107 mi, with sensible decimals per category. Keep the last 10 conversions in a list and add a menu option to show them. Done when: results are cleanly formatted, and the history shows the recent conversions.
- 06
Test it
~1.5hCreate an xUnit test project and test the Converter: every category, round trips (converting and back gives the original), negative temperatures, values below absolute zero, and currency conversions. Done when: dotnet test passes.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack