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
UkoKoshka [18]
3 years ago
8

java Your program class should be called RomanNumerals 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 Roman numeral version of that number. Do not accept a number less than 1 or greater than 10. s

Engineering
2 answers:
Ann [662]3 years ago
6 0

Answer:

// Scanner class is imported to allow program

// receive input

import java.util.Scanner;

// RomanNumerals class is defined

public class RomanNumerals {

   // main method that signify beginning of program execution

   public static void main(String args[]) {

       // Scanner object scan is created

       // it receive input via keyboard

       Scanner scan = new Scanner(System.in);

       // Prompt is display asking the user to enter number

       System.out.println("Enter your number: ");

       // the user input is stored at numberOfOrder

       int number = scan.nextInt();

     

           // switch statement which takes number as argument

           // the switch statement output the correct roman numeral

           // depending on user input

          switch(number){

           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;

           // this part is executed if user input is not between 1 to 10

           default:

               System.out.println("Error. Number must be between 1 - 10.");

     }

   }

}

Explanation:

The program is well commented. A sample image of program output is attached.

The switch statement takes the user input (number) as argument as it goes through each case block in the switch statement and match with the corresponding case to output the roman version of that number. If the number is greater 10 or less than 1; the default block is executed and it display an error message telling the user that number must be between 1 - 10.

Iteru [2.4K]3 years ago
6 0
<h2>Answer:</h2>

//import the Scanner class to allow for user's input

import java.util.Scanner;

// Write the class header with the appropriate name

public class RomanNumerals {

   // Write the main method - this is where execution begins

   public static void main(String[] args) {

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

       Scanner input = new Scanner(System.in);

       

       //Prompt the user to enter a number

       System.out.println("Please enter a number within the range of 1 through 10");

       

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

       int num = input.nextInt();

       

       

       //Begin the switch statement using the num

       switch (num) {

       

           //If the number is 1

           //Print the corresponding Roman numeral -> I

           //Then break out of the switch statement

           case 1 :  

               System.out.println("I");

               break;

               

           //If the number is 2

           //Print the corresponding Roman numeral -> II

           //Then break out of the switch statement

           case 2 :

               System.out.println("II");

               break;

               

           //If the number is 3

           //Print the corresponding Roman numeral -> III

           //Then break out of the switch statement

           case 3:

               System.out.println("III");

               break;

               

           //If the number is 4

           //Print the corresponding Roman numeral -> IV

           //Then break out of the switch statement

           case 4:

               System.out.println("IV");

               break;

               

           //If the number is 5

           //Print the corresponding Roman numeral -> V

           //Then break out of the switch statement

           case 5:

               System.out.println("V");

               break;

               

           //If the number is 6

           //Print the corresponding Roman numeral -> VI

           //Then break out of the switch statement

           case 6:

               System.out.println("VI");

               break;

               

           //If the number is 7

           //Print the corresponding Roman numeral -> VII

           //Then break out of the switch statement

           case 7:

               System.out.println("VII");

               break;

             

           //If the number is 8

           //Print the corresponding Roman numeral -> VIII

           //Then break out of the switch statement

           case 8:

               System.out.println("VIII");

               break;

           

           //If the number is 9

           //Print the corresponding Roman numeral -> IX

           //Then break out of the switch statement

           case 9:

               System.out.println("IX");

               break;

               

           //If the number is 10

           //Print the corresponding Roman numeral -> X

           //Then break out of the switch statement

           case 10:

               System.out.println("X");

               break;

           

           //If the number is not within range [That is the default case]

           //Print the corresponding error message.  

           //You might want to print the error message using  

           //System.err.println() rather than

           //the regular System.out.println()

           //Then break out of the switch statement

           default:

               System.err.println("Error: The number should not be less than 1 or greater than 10");

               break;

               

       }          //End of switch statement

       

       

  }  // End of main method

   

}  // End of class declaration

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

<h2><u>Sample Output 1:</u></h2>

>> Please enter a number within the range of 1 through 10

5

>> V

<h2></h2>

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

<h2><u>Sample Output 2:</u></h2>

>> Please enter a number within the range of 1 through 10

0

>> Error: The number should not be less than 1 or greater than 10

<h2 />

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

<h2></h2><h2></h2><h2></h2><h2></h2><h2>Explanation:</h2>

The code has been written in Java and it contains comments explaining every section of the code, please go through the comments to get a better understanding of the code.

Actual codes are written in bold face to distinguish them from the comments.

You might be interested in
Who can work on a fixed ladder that extends more than 24 feet?
baherus [9]

Answer:

Explanation:

If the fixed ladder will reach more than twenty-four (24) feet above a lower level, you as the employer are required to incorporate a personal fall arrest or ladder safety system into the installation of the ladder. For reference, this requirement is cited in OSHA Section 1910.28(b)(9)(i).

If the total length of the climb on a fixed ladder equals or exceeds 24 feet (7.3 m), the ladder must be equipped with ladder safety devices; or self-retracting lifelines and rest platforms at intervals not to exceed 150 feet (45.7 m); or a cage or well and multiple ladder sections with each ladder section not

plz mark as brainliest

8 0
3 years ago
How do you make a 3d print
yulyashka [42]

Answer:you need a 3d printer

Explanation:

5 0
3 years ago
The coefficient of static friction for both wedge surfaces is μw=0.4 and that between the 27-kg concrete block and the β=20° inc
balandron [24]

Assuming  the wedge has an angle of 5°.The minimum value of the force P that is required to begin moving the block up the incline is: 322.84 N.

<h3>Minimum value of force P</h3>

First step

Using this formula to find the weight of the block

W=mg

W=27×9.81

W=264.87 N

Second step

Angles of friction ∅A and ∅B

∅A=tan^-1(μA)

∅A=tan^-1(0.70)

∅A=34.99°

∅B=tan^-1(μB)

∅B=tan^-1(0.40)

∅B=21.80°

Third step

Equate the sum of forces in m-direction to 0 in order to find the reaction force at B.

∑fm=0

W sin (∅A+20°)  + RB cos (∅B+∅A)=0

264.87 sin(34.99°+20°) + RB cos (21.80°+34.99°)=0

216.94+0.5477Rb=0

RB=216.94/0.5477

RB=396.09 N

Fourth step

Equate the sum of forces in x-direction to 0 in order to find force Rc.

∑fx=0

RB cos (∅B) - RC cos (∅B+ 5°)=0

396.09 cos(21.80°) - RC cos (21.80°+5°)=0

RC=396.09 cos(21.80°)/cos(26.80°)

RC=412.02 N

Last step

Equate the sum of forces in y-direction to 0 in order to find force P required to move the block up the incline.

∑fy=0

RB sin (∅B) + RC sin (∅B)-P=0

P=Rb sin (∅B) + RC sin (5°+∅B)

P=396.09 sin(21.80°) +412.02sin (5°+21.80°)

P=322.84 N

Inconclusion the minimum value of the force P that is required to begin moving the block up the incline is: 322.84 N.

Learn more about Minimum value of force P here:brainly.com/question/20522149

7 0
2 years ago
10–25. The 45° strain rosette is mounted on the surface of a shell. The following readings are obtained for each gage: ε a = −20
vazorg [7]

Answer:

The answer is 380.32×10^-6

Refer below for the explanation.

Explanation:

Refer to the picture for brief explanation.

7 0
3 years ago
An equal-tangent sag vertical curve (with a negative initial and a positive final grade) is designed for 55 mi/h. The PVI is at
Varvara68 [4.7K]

Answer:

The lowest point of the curve is at 239+42.5 ft where elevation is 124.16 ft.

Explanation:

Length of curve is given as

L=2(PVT-PVI)\\L=2(242+30-240+00)\\L=2(230)\\L=460 ft

G_2 is given as

G_2=\frac{E_{PVT}-E_{PVI}}{0.5L}\\G_2=\frac{127.5-122}{0.5*460}\\G_2=0.025=2.5 \%

The K value is given from the table 3.3 for 55 mi/hr is 115. So the value of A is given as

A=\frac{L}{K}\\A=\frac{460}{115}\\A=4

A is given as

-G_1=A-G_2\\-G_1=4.0-2.5\\-G_1=1.5\\G_1=-1.5\%

With initial grade, the elevation of PVC is

E_{PVC}=E_{PVI}+G_1(L/2)\\E_{PVC}=122+1.5%(460/2)\\E_{PVC}=125.45 ft\\

The station is given as

St_{PVC}=St_{PVI}-(L/2)\\St_{PVC}=24000-(230)\\St_{PVC}=237+70\\

Low point is given as

x=K \times |G_1|\\x=115 \times 1.5\\x=172.5 ft

The station of low point is given as

St_{low}=St_{PVC}-(x)\\St_{low}=23770+(172.5)\\St_{low}=239+42.5 ft\\

The elevation is given as

E_{low}=\frac{G_2-G_1}{2L} x^2+G_1x+E_{PVC}\\E_{low}=\frac{2.5-(-1.5)}{2*460} (1.72)^2+(-1.5)*(1.72)+125.45\\E_{low}=124.16 ft

So the lowest point of the curve is at 239+42.5 ft where elevation is 124.16 ft.

3 0
3 years ago
Other questions:
  • Consider the following class definitions: class smart class superSmart: public smart { { public: public: void print() const; voi
    6·1 answer
  • Vehicles arrive at a single toll booth beginning at 8:00 A.M. They arrive and depart according to a uniform deterministic distri
    9·1 answer
  • Consider a sinusoidal oscillator consisting of an amplifier having a frequency-independent gain A (where A is positive) and a se
    6·1 answer
  • Ball joints on a vehicle equipped with MacPherson struts are being inspected for wear. Which of the following would be the corre
    11·1 answer
  • What are example for mantle
    5·1 answer
  • BIG POINTS AND WILL GIVE BRAINLIEST! Answer all 5 please or I can’t give brainliest and might report!
    10·1 answer
  • If a nurse does not agree to the discipline set due to a complaint made against this nurse, after reviewing the proposed agreed
    14·1 answer
  • What is the difference between a series circuit and a parallel circuit?
    11·2 answers
  • Which one of the following best defines hardness: (a) energy absorbed by a material when an object strikes its surface, (b) resi
    8·1 answer
  • What is chemical engieering ?​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!