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
DRIVERS ED
forsale [732]

Answer:

b

Explanation:

only if there signal is turned on

8 0
3 years ago
Read 2 more answers
All of these are true about GMA (MIG) welding EXCEPT that:
Hatshy [7]

Answer:

the welding gun liner regulates the shielding gas.

Explanation:

The purpose of the welding gun liner is to properly position the welding wire from the wire feeder till it gets to the nozzle or contact tip of the gun. <em>Regulation of the shielding gas depends on factors such as the speed, current, and type of gas being used. </em>In gas metal arc welding, an electric arc is used to generate heat which melts both the electrode and the workpiece or base metal.

The electric arc produced is shielded from contamination by the shielding gas. The heat generated by the short electric arc is low.

3 0
3 years ago
A horizontal curve of a two-lane undivided highway (12-foot lanes) has a radius of 678 feet to the center line of the roadway. A
OLEGan [10]

Answer:

maximum speed for safe vehicle operation = 55mph

Explanation:

Given data :

radius ( R ) = 678 ft

old building located ( m )= 30 ft

super elevation = 0.06

<u>Determine the maximum speed for safe vehicle operation </u>

firstly calculate the stopping sight distance

m = R ( 1 - cos \frac{28.655*S}{R} )  ----  ( 1 )

R = 678  

m ( horizontal sightline ) = 30 ft

back to equation 1

30 = 678 ( 1 - cos (28.655 *s / 678 ) )

( 1 - cos (28.655 *s / 678 ) )  = 30 / 678 = 0.044

cos \frac{28.65 *s }{678}  = 1.044

hence ; 28.65 * s = 678 * 0.2956

s = 6.99 ≈ 7 ft

next we will calculate the design speed ( u ) using the formula below

S = 1.47 ut  + \frac{u^2}{30(\frac{a}{3.2} )-G1}  ----  ( 2 )

t = reaction time,  a = vehicle acceleration, G1 = grade percentage

assuming ; t = 2.5 sec , a = 11.2 ft/sec^2, G1 = 0

back to equation 2

6.99 = 1.47 * u * 2.5 + \frac{u^2}{30[(11.2/32.2)-0 ]}

3.675 u  + 0.0958 u^2 - 6.99 = 0

u ( 3.675 + 0.0958 u ) = 6.99

5 0
3 years ago
What would be the structure for the body points for a persuasive presentation?.
Nataliya [291]
A persuasive speech is structured like an informative speech. It has an introduction with an attention-getter and a clear thesis statement. It also has a body where the speaker presents their main points and it ends with a conclusion that sums up the main point of the speech.
5 0
2 years ago
A steam power plant operates on an ideal reheat- regenerative Rankine cycle and has a net power output of 80 MW. Steam enters th
trasher [3.6K]

Answer:

flow(m) = 54.45 kg/s

thermal efficiency u = 44.48%

Explanation:

Given:

- P_1 = P_8 = 10 KPa

- P_2 = P_3 = P_6 = P_7 = 800 KPa

- P_4 = P_5 = 10,000 KPa

- T_5 = 550 C

- T_7 = 500 C

- Power Output P = 80 MW

Find:

-  The mass flow rate of steam through the boiler

-  The thermal efficiency of the cycle.

Solution:

State 1:

P_1 = 10 KPa , saturated liquid

h_1 = 192 KJ/kg

v_1 = 0.00101 m^3 / kg

State 2:

P_2 = 800 KPa , constant volume process work done:

h_2 = h_1 + v_1 * ( P_2 - P_1)

h_2 = 192 + 0.00101*(790) = 192.80 KJ/kg

State 3:

P_3 = 800 KPa , saturated liquid

h_3 = 721 KJ/kg

v_3 = 0.00111 m^3 / kg

State 4:

P_4 = 10,000 KPa , constant volume process work done:

h_4 = h_3 + v_3 * ( P_4 - P_3)

h_4 = 721 + 0.00111*(9200) = 731.21 KJ/kg

State 5:

P_5 = 10,000 KPa , T_5 = 550 C

h_5 = 3500 KJ/kg

s_5 = 6.760 KJ/kgK

State 6:

P_6 = 800 KPa , s_5 = s_6 = 6.760 KJ/kgK

h_6 = 2810 KJ/kg

State 7:

P_7 = 800 KPa , T_7 = 500 C

h_7 = 3480 KJ/kg

s_7 = 7.870 KJ/kgK

State 8:

P_8 = 10 KPa , s_8 = s_7 = 7.870 KJ/kgK

h_8 = 2490 KJ/kg

- Fraction of steam y = flow(m_6 / m_3).

- Use energy balance of steam bleed and cold feed-water:

                                        E_6 + E_2 = E_3

               flow(m_6)*h_6 + flow(m_2)*h_3 = flow(m_3)*h_3

                                    y*h_6 + (1-y)*h_3 = h_3

                                  y*2810 + (1-y)*192.8 = 721

Compute y:                          y = 0.2018

- Heat produced by the boiler q_b:

                             q_b = h_5 - h_4 +(1-y)*(h_7 - h_8)

                    q_b = 3500 -731.21 + ( 1 - 0.2018)*(3480 - 2810)

Compute q_b:               q_b = 3303.58 KJ/ kg

-Heat dissipated by the condenser q_c:

                                       q_c = (1-y)*(h_8 - h_1)

                                 q_c= ( 1 + 0.2018)*(2810 - 192)

Compute q_c:               q_c = 1834.26 KJ/ kg

- Net power output w_net:

                                     w_net = q_b - q_c

                                w_net = 3303.58 - 1834.26

                                    w_net = 1469.32 KJ/kg

- Given out put P = 80,000 KW

                                     flow(m) = P / w_net

compute flow(m)          flow(m) = 80,000 /1469.32 = 54.45 kg/s

- Thermal efficiency u:

                                     u = 1 - (q_c / q_b)

                                     u = 1 - (1834.26/3303.58)

                                     u = 44.48 %

5 0
3 years ago
Other questions:
  • The ratio of the weight of a substance to the weight of equal volume of water is known as a) Density b) specific gravity c) spec
    8·1 answer
  • 3. Air at 1 atm and 20 0 C flows tangentially on both sides of a smooth flat plate of width W=10 ft and length L=10 ft in the di
    8·1 answer
  • Liquid flows at steady state at a rate of 2 lb/s through a pump, which operates to raise the elevation of the liquid 100 ft from
    6·1 answer
  • The cost of hiring new employees outpaces the raises for established employees is
    5·1 answer
  • Trapezoidal screw press project
    6·1 answer
  • Who was the American founder and leader of the Shakers in the 1770’s who advocated equality, individual responsibility, and peac
    11·2 answers
  • Determine the resistance of 100m of copper cable whose cross-sectional area is 1.5mm2​
    6·1 answer
  • Crank OA rotates with uniform angular velocity 0  4 rad/s along counterclockwise. Take OA= r= 0.5
    11·1 answer
  • Deviations from the engineering drawing cannot be made without the approval of the
    15·2 answers
  • If a population has no predadors and plenty of available resources, how might that population change
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!