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
kobusy [5.1K]
3 years ago
8

Modify any of the previous labs which would have crashed when non-numeric data was entered by adding exception handling so that

the non-numeric input no longer crashes the program. The program must handle the invalid input gracefully by informing the user of the bad input and re-querying until the user provides valid input. It must re-query for the specific input which was incorrectly entered.
Engineering
1 answer:
Mashutka [201]3 years ago
7 0

Answer:

see explaination

Explanation:

import java.util.InputMismatchException;

import java.util.Scanner;

public class calculate {

static float a=0,b=0;

double cal()

{

if(a==0||b==0)

{

System.out.println("no values found in a or b");

start();

}

double x=(a*a)+(b*b);

double h=Math.sqrt(x);

a=0;

b=0;

return h;

}

float enter()

{

float val=0;

try

{

System.out.println("Enter side");

Scanner sc1 = new Scanner(System.in);

val = sc1.nextFloat();

return val;

}

catch(InputMismatchException e)

{

System.out.println("Enter correct value");

}

return val;

}

void start()

{

calculate c=new calculate();

while(true)

{

System.out.println("Enter Command");

Scanner sc = new Scanner(System.in);

String input = sc.nextLine();

switch(input)

{

case "A":

a=c.enter();

break;

case "B":

b=c.enter();

break;

case "C":

double res=c.cal();

System.out.println("Hypotenuse is : "+res);

break;

case "Q":

System.exit(0);

default:System.out.println("wrong command");

}

}

}

public static void main(String[] args) {

calculate c=new calculate();

c.start();

}

}

You might be interested in
2.2 k omega= _____ omega
neonofarm [45]

Explanation:

2.2 k omega= ___2200__ omega

here k is kilo so simply multiply by 1000

8 0
3 years ago
Identify the true statements about the relationship between the distillate and the sample mixture in a simple distillation.
fenix001 [56]

Answer:

The answer is "Choice b,c, and d".

Explanation:

The distillation would be the separation phase of working liquids that boil close to each other. Whenever the formulation is long-term, a much more fraction of a compound collected will have a lower boiling point than it would otherwise be. In other phrases, it'll be pulverized with both the lower level, also with the boiling point. Its structure of both the diluted volatile component may therefore include another cell's contaminants.

8 0
3 years ago
A helicopter moves horizontally in the x direction at a speed of 120 mi/h. Knowing that the main blades rotate clockwise when vi
devlian [24]

Answer:

The instantaneous axis of rotation=

x = 0 ; z = 8.4 ft

Explanation:

Given:

Speed of helicopter, Vo= 120 mi/h, converting to ft/sec, we have:

\frac{5280 * 120}{60*60}

= 176 ft/s

Angular velociyy, w = 220 rpm, converting to rad/sec, we have: \frac{200*2*pi}{60} =20.95 rad/s

The helicopter moves horizontally in the x direction at a speed of 120 mi/h, this means that the helicopter moves in the positive x direction at 120mi/h

To find the instantaneous axis of rotation of the main blades, we have:

Where Vc = 20.95 rad/s

Vo = 176 ft/s

z = \frac{V_0}{V_c} = \frac{176ft/s}{20.95rad/s}

= 8.4 ft

Therefore the axis of rotation=

x = 0 ; z = 8.4 ft

4 0
3 years ago
The shape of the wood beam is a rectangle. In a paragraph explain the tradeoffs an engineer would make in selecting a wood with
oksian1 [2.3K]

Answer:

Wood is heavy

Explanation:

7 0
3 years ago
Injection melding is a process that
Bumek [7]

Answer:

mark brainliest :)

Explanation:

Injection Molding. Injection molding is the most commonly used manufacturing process for the fabrication of plastic parts. ... The plastic is melted in the injection molding machine and then injected into the mold, where it cools and solidifies into the final part.

Materials: Thermoplastics

5 0
3 years ago
Other questions:
  • An aluminium bar 600mm long with diameter 40mm has a hole drilled in the centre of the bar. The hole is 30mm in diameter and is
    15·1 answer
  • 9. The baseball catcher throws a ball vertically upward and catches it in the same spot as it returns to themitt. At what point
    14·2 answers
  • 2. What is the original length of the rectangular bar if the deformation is 0.005 in with a force of 1000 lbs and an area of 0.7
    9·1 answer
  • Select the correct text in the passage.
    6·2 answers
  • When could you use the engineering design process in your own life?
    9·1 answer
  • can you give me a paragraph on What is Electrical Engineering and why is it considered the largest branch of Engineering? I real
    15·1 answer
  • Sylvie has a robot that helps her wash dishes. Which of the following must be true?
    5·1 answer
  • on the same scale for stress, the tensile true stress-true strain curve is higher than the engineeringstress-engineering strain
    10·1 answer
  • While servicing a vehicle, you retrieve the diagnostic code P0401, "EGR (exhaust gas recirculatior flow insufficient." Which of
    10·1 answer
  • A high compression ratio may result in;
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!