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
What is the 10th term for sequence 4; 8; 13; 19; 26​
Mariana [72]

Answer:

40

Step-by-step explanation:

3 0
2 years ago
The area of a triangle whose height is 1 more than 6 times its base is 13 square feet. If the base of the triangle is x feet, wh
Orlov [11]
6x + 1 = 13

Hope this helps!
6 0
3 years ago
-1 and 1/4th divided by - 1/2
omeli [17]

Answer: 2

Step-by-step explanation:

5 0
3 years ago
What is the value of 0.34×9.
anastassius [24]


The answer is 3.06  

0.34

x     9

_________

3.06                              Just multiply 0.34*9=3.06  then count two places left to  place the  decimal point in the proper place

3 0
3 years ago
Read 2 more answers
Please answer assapapapapppp
Amanda [17]
That is the answer it was to long to write down

8 0
3 years ago
Other questions:
  • 7 consecutive numbers that add up to 777
    5·2 answers
  • What is most likely the length of a telephone book
    9·1 answer
  • Consider the expression 4x-3 what is the value of the expression when x=7. What is the value of the expression when x=22
    8·2 answers
  • Which fraction belongs in the box to make the expression true? 1/4 &lt; ___&lt; 7/8. A. 1/5. B. 8/9. C. 2/10. D. 10/20
    11·2 answers
  • Please help I need good grade on this
    12·1 answer
  • What is the answer of y=4x-6
    8·2 answers
  • The point-slope form of the equation of the line that passes through (–4, –3) and (12, 1) is y – 1 = (x – 12). What is the stand
    9·2 answers
  • There are 30 students in a class. 17 of the students are boys. What percent of the class are girls.
    10·1 answer
  • HELP!!! I RLY NEED HELP WITH THIS!
    12·2 answers
  • Triangle FIT has been reflected over the y-axis. Which of the following best describes the relationship between the y-axis and t
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!