public static void main(String[] args) {
// Given a Scanner as input, prompts the user to input a number between 1 and 3999.
// Checks to make sure the number is within range, and provides an error message until
// the user provides a value within range. Returns the number input by the user to the
// calling program.
private static int promptUserForNumber(Scanner inScanner) {
Scanner Keyboard = new Scanner(System.in);
System.out.print("Please enter a number between 1 and 3999 (0 to quit): ");
int number = Keyboard.nextInt();
int number1 = number;
String roman="";
while(number<=0 || number>3999){
System.out.println("ERROR! Number must be between 1 and 3999");
number = Keyboard.nextInt();
number1=number;
}
}
private static convertNumberToNumeral(int number) {
while(number>=1000){
roman += "M";
number-=1000;
}
while(number>=900){
roman += "CM";
number-=900;
}
while(number>=500){
roman += "D";
number-=500;
}
while(number>=400){
roman += "CD";
number-=400;
}
while(number>=100){
roman += "C";
number-=100;
}
while(number>=90){
roman += "XC";
number-=90;
}
while(number>=50){
roman += "L";
number-=50;
}
while(number>=40){
roman += "XL";
number-=40;
}
while(number>=10){
roman += "X";
number-=10;
}
while(number>=9){
roman += "IX";
number-=9;
}
while(number>=5){
roman += "V";
number-=5;
}
while(number>=4){
roman += "IV";
number-=4;
}
while(number>=1){
roman += "I";
number-=1;
}
System.out.println(number1 + " in Roman numerals is " + roman);
}
}
// Given a digit and the Roman numerals to use for the "one", "five" and "ten" positions,
// returns the appropriate Roman numeral for that digit. For example, if the number to
// convert is 49 we would call convertDigitToNumeral twice. The first call would be:
// convertDigitToNumeral(9, 'I','V','X')
// and would return a value of "IX". The second call would be:
// convertDigitToNumeral(4, 'X','L','C')
// and would return a value of "XL". Putting those together we would see that 49 would be the
// Roman numeral XLIX.
// Call this method from convertNumberToNumeral above to convert an entire number into a
// Roman numeral.
private static convertDigitToNumeral(int digit, char one, char five, char ten) {
// Fill in the body
}
} I have to do a integer to Roman Numeral program by following these comments.I am following the methods, but i don't know how to send things back to main and i don't understand the private static convertDigitToNumeral vs. convertNumberToNumeral. I am really confused.