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
Mandy and Jeff start running around the track in the same direction at the same time. Mandy runs one lap in 2 minutes and 30 sec
Savatey [412]

Answer:

At 8:52:30 am they will be side-by-side again

Step-by-step explanation:

Let s be the distance ran in one 1 lap.

Here Jeff runs one extra lap compared to Mandy for coming side by side again.

Mandy runs one lap in 2 minutes and 30 seconds = 150 s

Speed of Mandy, =\frac{s}{150}

Jeff runs one lap in 2 minutes and 15 seconds = 135 s

Speed of Jeff, =\frac{s}{135}

Let t be the time when Jeff run one extra lap,

That is

              t\times \frac{s}{135}-t\times \frac{s}{150}=s\\\\t\left ( \frac{1}{135}-\frac{1}{150}\right )=1\\\\t\times \frac{15}{135\times 150}=1\\\\t=1350s

So after 1350 seconds Jeff comes side by side to Mandy,

They both start at 8:30 am

             1350 s = 22.5 minutes = 22 minutes 30 seconds

          Time = 8:52:30 am

3 0
3 years ago
Some one please help me on 8. Thank you.
balandron [24]
Let's say you had 12 campers with you so
Your tent 1
Then you need to divide the campers into 3s so 4 groups of 3
1 tent for each group of 3
So take C divid it by 3 plus you're 1 tent
C = number of campers

Hope this helps
6 0
3 years ago
Again I am having some trouble on here
Julli [10]

I don't know honey, but I think it can be the 2nd choice, the answer...

50 miles/1 hour = ? miles/200 miles.

I hope I helped and goodluck :)

4 0
3 years ago
|x-20| if x&lt;-20<br> I need help with the opposite equation
yKpoI14uk [10]
-(x-20)
Basically it’s the same as your other question but your not adding twenty!
4 0
2 years ago
Trabajadores 360 180 120 80 60
My name is Ann [436]

Answer:

b

Step-by-step explanation:

answer is b

3 0
3 years ago
Other questions:
  • Fertilizer is sold in 100 pound bags labelled with the amount of nitrogen ( N), phosphoric acid ( P2O5), and potash ( K2O) prese
    8·1 answer
  • 1. Identify the number of terms in the<br>expression 9m + 7.<br>:​
    7·1 answer
  • Life or death situation!!!<br> Can someone please help me with this
    9·1 answer
  • Sketch a graph of the relation y+4=2(x-3)
    6·1 answer
  • Given (x)=-x²+2x,determine<br> F'(x) using first principle
    8·1 answer
  • HURRY PLEASE!!!!!!!!!!!!! I AM GIVING BRAINLISTS (when you answer do 4/5 + 1/3 = ???. Thank you)
    5·1 answer
  • Ben wants to sell popcorn. He investigates the surface area and volume of popcorn containers. One popcorn container is a rectang
    9·1 answer
  • Hi, can someone please answer this questions, THANKS
    7·1 answer
  • Evaluate the expression <br> 33(4a), if a = 2.
    14·1 answer
  • Who is the president of Tanzania?​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!