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
Nine more than the product of -8 and a number is -7
Yanka [14]

Answer:

-9

Step-by-step explanation:

5 0
3 years ago
Read 2 more answers
you are at the mall and you want to buy a hoodie for 35 dollars its on sale for 25 percent off how do you find the discounted pr
Gnesinka [82]

Answer:$8.75

Step-by-step explanation:Thus, a product that normally costs $35 with a 25 percent discount will cost you $26.25, and you saved $8.75. You can also calculate how much you save by simply moving the period in 25.00 percent two spaces to the left, and then multiply the result by $35 as follows: $35 x .25 = $8.75 savings.

6 0
3 years ago
Is one over eight irrational or rational
lukranit [14]
The answer to this is irrational
4 0
3 years ago
9x-7=-7<br><img src="https://tex.z-dn.net/?f=9x%20-%207%20%3D%20-%207" id="TexFormula1" title="9x - 7 = - 7" alt="9x - 7 = - 7"
scZoUnD [109]

Answer:

x= 0

Step-by-step explanation:

Here in this question, we are given a linear equation of single variable x, and we have to solve the equation for x.

The given equation is 9x -7= -7 ....... (1)

Now, taking all the constant terms to the right side of the equation and all the x terms to the left side of the equation.

Hence, the equation becomes  

9x = -7 +7

⇒ 9x =0 {Since, -7 and 7 cancels each other}

⇒ x= 0/9= 0 (Answer) {Since zero divided by any number is equal to zero}

7 0
3 years ago
a bakery sold 31 bagels in the first hour of business and 42 bagels in the second hour. if the baker had 246 bagels to start, ho
bogdanovich [222]

Answer:

173 bagels were left after the second hour!!

Step-by-step explanation:

7 0
2 years ago
Other questions:
  • Four out of 5 dentists recommend Sparkle toothpaste. What percent of dentists recommend sparkle toothpaste?
    10·2 answers
  • One positive number is 4 more than twice another. Their product is 198
    6·2 answers
  • PQ=RQ <br> i’m looking for A in the problem
    5·1 answer
  • Which of the following is not approximately equivalent to one of the metric units: 1 kilometer, 1 meter, 1 kilogram, or 1 liter?
    11·2 answers
  • Katya decided that she could not afford the $48,000 it would cost her to attend college and get her four-year degree. Instead, s
    15·1 answer
  • How many envelopes does Jane address in a day?
    13·2 answers
  • Help asap pleaseeee !!!!!!
    8·1 answer
  • The ratio of two sums of money are 4:5. the first sum is $6. what is the second?
    12·1 answer
  • Need answer for this question please.
    9·1 answer
  • 3/10 1/2 common denominator
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!