14,977,302 members
1.00/5 (1 vote)
See more:
Write a program that takes a decimal value between 1 and 10 and displays its equivalent Roman numeral value. Display an error message if the value entered is outside of the acceptable range. Write a two class solution. The second class should allow the user to input a test value.

What I have tried:

I don't seem to understand what to actually do.
Posted
Updated 16-May-21 20:53pm

## Solution 1

I wonder if someone, in the web, did understand such requirements...
convert number to roman numeral program example - Google Search[^]

## Solution 2

Quote:
Write a program that takes a decimal value between 1 and 10 and displays its equivalent Roman numeral value.

This means that:
```Input -> Result
1 -> I
2 -> II
3 -> III
4 -> IV
5 -> V
6 -> VI
7 -> VII
8 -> VIII
9 -> IX```

## Solution 3

Roman numbers aren't difficult, and this is a relatively simple problem that is given as homework to tens of thousands of students every year.
In this case it's trivial because you only have to deal with ten values:
``` 1    I
2   II
3  III
4   IV
5    V
6   VI
7  VII
8 VIII
9   IX
10    X```

So, start by reading this: How to Write Code to Solve a Problem, A Beginner's Guide[^] and then think about what you have done in previous exercises.

I'm pretty sure you have read input from the user before, converted it to a number, done some processing on it, and printed the result - so there is the basis for your app:
C#
```public static void Main()
{
int value = Input.GetInteger("Enter value to convert to Roman Numerals (1 to 10 only)", 1, 10);
string roman = ConvertToRoman(value);
Console.WriteLine(\$"{value} is {roman} in Roman Numerals");
}
private static string ConvertToRoman(int value)
{
...
}
...
public static class Input
{
public static int GetInteger(string prompt, int min, int max)
{
...
}
}```
Now all you have to do is "fill in the blanks" and write two very simple methods.
Hint: GetInteger will want a loop that reports problems until the user enters a valid number between the min and max, and you might want to look at the TryParse methods to convert the input to a number (Google will help you there).