Day 2: Roman Numerals
Exercise
Write a Java program to convert years written with Arabic numerals to Roman numerals.
Introduction
These are the symbols and their associated values for Roman numerals.
| Symbol | Value |
|---|---|
| I | 1 (one) |
| V | 5 (five) |
| X | 10 (ten) |
| L | 50 (fifty) |
| C | 100 (one hundred) |
| D | 500 (five hundred) |
| M | 1000 (one thousand) |
Use the division (/) and modulo (%) operators to determine how many of each symbol is needed in the output
Algorithm
- Implement the core functionality using a text-based interface for I/O.
- Build a GUI to wrap your implementation.
Resources
- Main.java (text-based interface)
- Roman Numeral Converter (check your answer)
- Roman numerals (Wikipedia)
Hints