hello, i am trying to write a program that asks the user to enter a number from 1 through 10 and then the program will display the roman numeral for that number.
i am also adding a error message in which i haven't yet because im still trying to figure out how to the program will do the roman numeral.'
i have used the if and else if. but when i input a number it just repeats the number back to me.
the program cimpiles but it doesn't do what i want. here is what i have so far. how can i get the program to display the roman numeral after the number is entered.
import javax.swing.JOptionPane; public class Romannumeral { public static void main(String[] args) { double number; String input; number = Double.parseDouble(JOptionPane.showInputDialog("Enter a number within the range of 1 through 10.")); if (number == 1) { System.out.println("I"); } else if (number == 2) { System.out.println("II"); } else if (number == 3) { System.out.println("III"); } else if (number == 4) { System.out.println("IV"); } else if ( number == 5 ) { System.out.println("V"); } else if (number == 6) { System.out.println("VI"); } else if (number == 7) { System.out.println("VIII"); } else if (number == 8) { System.out.println("VIIII"); } else if (number == 9) { System.out.println("IX"); } else if (number == 10) { System.out.println("X"); } JOptionPane.showMessageDialog(null, "Roman numeral: + input " ); } }