1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Angelina_Jolie [31]
4 years ago
12

Write a program that asks the user to enter a number within the range of 1 through 10. Use a switch statement to display the Rom

an 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 program should be just a Roman numeral, such as VII. CLASS NAMES. Your program class should be called RomanNumerals
Computers and Technology
1 answer:
Snezhnost [94]4 years ago
6 0
<h2>Answer:</h2>

//import the Scanner class to enable user's input

import java.util.Scanner;

// Declare the class header with RomanNumerals as name

public class RomanNumerals {

   // Declare the main method where execution begins

   public static void main(String[] args) {

       //Instantiate an object of the Scanner class to allow user's to enter the number

       Scanner userinputscan = new Scanner(System.in);

       

       //Display a message to prompt the user to enter a number

       System.out.println("Enter a number in the range of 1 - 10");

       

       //Receive the number from the user and store in an int variable

       int usernumber = userinputscan.nextInt();

       

       

       //Start the switch statement using the usernumber

       switch (usernumber) {

       

           //Check if the number is 1

           //Display I

           //Then break out of the switch statement

           case 1 :  

               System.out.println("I");

               break;

               

           //If the number is 2

           //Display II

           //Then break out of the switch statement

           case 2 :

               System.out.println("II");

               break;

               

           //If the number is 3

           //Display III

           //Then break

           case 3:

               System.out.println("III");

               break;

               

           //If the number is 4

           //Display IV

           //Then break

           case 4:

               System.out.println("IV");

               break;

               

           //If the number is 5

           //Display V

           //Then break

           case 5:

               System.out.println("V");

               break;

               

           //If the number is 6

           //Display VI

           //Then break

           case 6:

               System.out.println("VI");

               break;

               

           //If the number is 7

           //Display VII

           //Then break

           case 7:

               System.out.println("VII");

               break;

             

           //If the number is 8

           //Display VIII

           //Then break

           case 8:

               System.out.println("VIII");

               break;

           

           //If the number is 9

           //Display IX

           //Then break

           case 9:

               System.out.println("IX");

               break;

               

           //If the number is 10

           //Display X

           //Then break

           case 10:

               System.out.println("X");

               break;

           

           //If the number is out of range [That is the default case]

           //Display an error message.  

           default:

               System.out.println("Error: The number is not within range");

               break;

               

       }          //End of switch statement

       

       

  }  // End of main method

   

}  // End of class declaration

<h2>Explanation:</h2>

The above code has comments explaining every part of the code. Please go through the comments.

The actual code has been written in bold face to distinguish it from comments.

===============================================================

<h2>Sample Output 1:</h2>

>> Enter a number in the range of 1 - 10

45

>> Error: The number is not within range

================================================================

<h2>Sample Output 2:</h2>

>> Enter a number in the range of 1 - 10

8

>> VIII

<h2 /><h2 /><h2 />
You might be interested in
What is the advantage of learning through story compared to learning through personal experience?
Inessa [10]

Answer:

Personal Experience

Explanation:

If a story is based on a personal experience then yes, the two doesn't matter. <em>However</em>, usually learning through personal experience is better because you learn firsthand while stories are written from a different perspective.

6 0
3 years ago
Read 2 more answers
7. Define ports including standard and<br>specialized ports. Give examples of each.​
Montano1993 [528]

Answer:

An example of a standard port is USB (universal serial bus) which connects several devices to the system unit. An example of a specialized port is Thunderbolt which is identified by Apple's MacBook Pro and provides a high-speed connection promising to replace a number of ports such as Mini Display port.

Explanation:

Please give brainlest

5 0
3 years ago
A DSS8440 server is equipped with one power supply that is failing and requires replacement. What is the correct sequence of ste
Alisiya [41]

Answer:

ICICI oxidized sicken o'clock o'clock succinct

6 0
3 years ago
What are the 3 parts of a browser window? What componets are in each?
Helga [31]
Here are the universal symbols: the minus symbol is minimize, the square(s) are for windowed mode, and the X symbol is for closing the browser. Branliest answer here.
7 0
4 years ago
You want to get information about DNS request types and DNS query packet content. What kind of DNS logging do you need to enable
ololo11 [35]

Answer:

Option C i.e., Analytic event logging is the correct answer.

Explanation:

The user required to enable Analytic event logging Type of DNS logging to take data or information related to the type of DNS request and also the content packet of the DNS query. By Analytic event logging, Users get data about the forms of DNS requests and the size of the DNS query packets. That's why the following option is correct.

8 0
3 years ago
Other questions:
  • Need answer quick
    9·1 answer
  • What are some ways to generate styles in Word documents? Check all that apply. selecting styles from preexisting galleries modif
    11·2 answers
  • The initial step of the five-step problem-solving model is to: A. Explore alternatives B. Clarify values. C. Develop an approach
    9·1 answer
  • Which of these components is a part of the central processing unit (cpu) of a computer??
    14·1 answer
  • Given the following function definition, what modifications need to be made to the search function so that it finds all occurren
    7·1 answer
  • Which tool is best used to test an electrical current for a power source?
    8·1 answer
  • In this lab, you will write a function called numberGuessingGame(). When the function is called, it will do the following: gener
    13·1 answer
  • WILL MARK BRAINLIEST!!!!!!!!!!!
    5·2 answers
  • Update thejavafile names to include your initials at the end, send .java file only.1. Completein-place heapSort, which takes an
    11·1 answer
  • Pls say correct guyz pls pls pls
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!