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
WITCHER [35]
3 years ago
9

Write a program that prompts the user to read two integers and displays their sum . if anything but an integer is passed as inpu

t, your program should catch the inputmismatchexception that is thrown and prompt the user to input another number by printing "please enter an integer ."
Mathematics
1 answer:
natka813 [3]3 years ago
4 0
<span>The Java code below will ask for two integers and display the sum. If a non-integer is submitted the code will ask again. The break is used to exit the while true loop indicating that no-errors had occurred and two numbers were added. System.out.print("Please insert two integers and this will display the sum."); int numOne; int numTwo; while (True) { try{ System.out.print("Integer Number One? "); numOne = input.nextInt(); System.out.print("Integer Number Two? "); numTwo = input.nextInt(); System.out.print("The Sum Is: " + (numOne + numTwo)); break; } catch (InputMismatchException e) { System.out.print("please enter an integer ."); } }</span>
You might be interested in
Lily and Sabrina often make some extra pocket money by painting garden sheds. Lily can paint a shed in 5 hours working alone, wh
prisoha [69]
Lily and sabring make extra pocket money by paint gradden shed lily can paint
3 0
3 years ago
A 25% vinegar solution is combined with triple the amount of a 45% vinegar solution and a 5% vinegar solution resulting in 20 mi
Murrr4er [49]

Complete Question: A 25% vinegar solution is combined with triple the amount of a 45% vinegar solution and a 5% vinegar solution resulting in 20 milliliters of a 30% vinegar solution.

Write an equation that models this situation and explain what each part represents in the situation. Then solve the equation.

Step-by-step explanation:

let the volume of the 45% vinegar solution be x litres ,

the volume of the 25% vinegar solution be 3x

and the volume of the 5% vinegar solution be y

summation of all gives,

x+3x+y = 20

4x + y = 20

subtracting 4x from both sides to make y the subject of the equation, we have;

y = 20 - 4x

To the concentration:

substituting for the value of x and y into equation x + 3x + y = 20, we have,

.45x + .25(3x) + .05(20-4x) = .3(20)

multiplying through by 100  to make whole figures we have;

45x + 25(3x) + 5(20-4x) = 600

45x + 75x + 100 - 20x = 600

120x - 20x + 100 = 600

100x + 100 = 600

subtracting 100 from both sides, we have;

100x = 600 - 100

100x = 500

dividing both sides by 100,

x = 5.

7 0
3 years ago
Write the equation of the line that passes through the points (-9,2) and (-2,8).
tresset_1 [31]

Answer:

y = 6/7x + 68/7

Step-by-step explanation:

5 0
3 years ago
Miranda and cyndi start hiking from the same point. miranda hikes at a heading of , or due west, and cyndi hikes at a heading of
igomit [66]

They are both 6.9 miles apart after one hour if they both hike 4 miles/hour

The correct option is (B)

<h3>What is the triangle?</h3>

In terms of geometry, the triangle is a three-sided polygon with three edges and three vertices. The triangle's interior angles add up to 180°.

<h3>According to the given information:</h3>

Miranda and Cyndi start hiking from the same point. Miranda hikes at a heading of 270° or due west, and Cyndi hikes at a heading of 30°

<h3>From the isosceles triangle:</h3>

h = 4sin30

h = 4(1/2)

h = 2 miles

<h3>From Pythagoras theorem:</h3>

x² = 4² - h² = 4² - 2²

x = √12

x = 3.46 miles

Total distance = 2×3.46  = 6.9 miles

Thus, they are both 6.9 miles apart after one hour if they both hike 4 miles/hour option (B) 6.9 miles is correct.

Learn more about the triangle here:

brainly.com/question/25813512

#SPJ4

I understand that the question you are looking for :

Miranda and Cyndi start hiking from the same point. Miranda hikes at a heading of , or due west, and Cyndi hikes at a heading of , or n e. if they both hike 4 miles/hour, approximately how far apart are they after one hour?

A) 4.3 miles. .

B) 6.9 miles

C) 8.0 miles

D) 5.7 miles

4 0
2 years ago
Find the missing fraction.Please
blagie [28]
The answer is 5 over 5 if i’m wrong sorry khcxkgxloyxh
3 0
3 years ago
Other questions:
  • Convert 1 3/4 into a decimal
    6·2 answers
  • How do I figure this out?
    8·1 answer
  • What is the pattern? 1,1 / 2,3 / 3,6 / 4,10 / 5,15. (x,y). Whoever answers gets brainliest!
    5·1 answer
  • PLZ HELP ME I WILL GIVE U BRAINLIEST!!!
    8·2 answers
  • Find the ratio in simplest form.<br> 30:6
    14·1 answer
  • If a = b and b = c, which statement must be true?
    11·1 answer
  • 7. Robert poys for his family to go bowling. He pays an initial fee
    10·1 answer
  • Simplify the following expression.
    7·1 answer
  • A ball is thrown from an intial height of 5 feet with an intial upward velocity of 17 ft/s. The ball's height h in feet after t
    9·1 answer
  • IAS 36. Impairment of asset. we are a photo
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!