How tephsav/calculator works
Project type and purpose
• This is a standalone console‐based calculator tool written in Java.
• Its sole responsibility is to read a single arithmetic expression from the command line, validate it (Arabic or Roman numerals between 1 and 10), perform one of four operations (+, –, *, /), and print the integer result (in the same numeral system as the input).
File structure
• Top-level files:
• README.md – describes requirements and usage
• .gitignore, .idea/, Calculator.iml – project metadata
• src/ directory holds four Java classes:
• Main.java – CLI entry point, reads input and prints output
• Expression.java– parses the raw string into operands and operator, enforces grammar rules
• Converter.java – handles Roman↔Arabic conversions
• Calculator.java– performs the four arithmetic operations
README for additional insights
• No external dependencies or frameworks are used—just pure Java SE.
• The requirements emphasize single‐operation expressions, strict input ranges, throw errors on invalid input, and mirror the numeral system in the output.
Detail
• Notes on input constraints (1–10, single operator).
• Exception paths for invalid input (non‐integer, mixed numeral systems, out‐of‐range).