Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

uye,98ction tba. Spring 2018 [ 80776 MIAMI DADE COLL-WEST CMPS Workbench Exercis

ID: 3877816 • Letter: U

Question

uye,98ction tba. Spring 2018 [ 80776 MIAMI DADE COLL-WEST CMPS Workbench Exercise 71103 X deadine: 02/04/2018 11 WORK AREA RESULTS 4.1: Roman Numeral Converter Roman numeral version of that number Input Validation: Do not accept a number less than 1 or greater than 10 Prompts And Output Labels. Use the following prompt for input: "Enter a number in the range of 1- 10: ". The output of the Write a program that asks the user to enter a number within the range of 1 through 10. Use a switch statement to disply the program should be just a Roman numeral, such as VII. CLASS NAMES. Your program class should be called RomanNumerals 13 of 13: Mon Jan 22 2018 21:35 57 GMT-0500 (EST) SUBMIT

Explanation / Answer

Here you go,

import java.util.Scanner;
public class RomanNumerals{
public static void main(String args[]) {

System.out.println("Enter a number in the range of 1-10:");
Scanner in = new Scanner(System.in);
int num = in.nextInt(); //gets input from user
if(num>10||num<1) // validates the number is not less than 1 and greater than 0
{
System.out.println("Please enter the number in range of 1-10");
}
else
{
switch (num)
{
case 1:
System.out.println("I");
break;
case 2:
System.out.println("II");
break;
case 3:
System.out.println("III");
break;
case 4:
System.out.println("IV");
break;
case 5:
System.out.println("V");
break;
case 6:
System.out.println("VI");
break;
case 7:
System.out.println("VII");
break;
case 8:
System.out.println("VIII");
break;
case 9:
System.out.println("IX");
break;
case 10:
System.out.println("X");
break;
  
}
}
}
}