answer.
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]
2 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]2 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
Factor completely.<br> ​ <br> 18b−32<br> ​<br> Enter your answer in the boxes.<br><br> ___(___)
Kamila [148]
To factor completely 18b - 32, we factor out the common factor of the two terms and divide each of term by the common factor.

18b - 32 = 2(18b/2 - 32/2) = 2(9b - 16)
5 0
2 years ago
Read 2 more answers
Drew earns money washing cars for his neighbors on the weekends. Drew charges a set rate for each car he washes.
statuscvo [17]

Answer:

30

Step-by-step explanation:

5 0
2 years ago
Read 2 more answers
A box of crayons costs $1.75, including tax. Mr. Valentino wants to purchase boxes of crayons for his class and has a $25 budget
Mnenie [13.5K]
         Mr. Valentino can`t go over his budget of $25. The amount of money times the amount of boxes needs to be less than or equal to $25:
         Answer: A ) $1.75 x  ≤ $25,
         where x is the amount of boxes he bought.
4 0
2 years ago
Read 2 more answers
A local pizzeria offers 15 toppings for their pizzas and you can choose any 3 of them for one fixed price. How many different ty
Shtirlitz [24]

Answer:

  455 or 680, depending

Step-by-step explanation:

If we assume the three choices are different, then there are ...

  15C3 = 15·14·13/(3·2·1) = 35·13 = 455

ways to make the pizza.

___

If two or three of the topping choices can be the same, then there are an additional ...

  2(15C2) +15C1 = 2·105 +15 = 225

ways to make the pizza, for a total of ...

  455 + 225 = 680

different types of pizza.

__

There is a factor of 2 attached to the number of choices of 2 toppings, because you can have double anchovies and tomato, or double tomato and anchovies, for example, when your choice of two toppings is anchovies and tomato.

_____

nCk = n!/(k!(n-k)!)

6 0
2 years ago
Jean spent $16 on new T-shirts. If each shirt cost the same whole-dollar amount, how many could she have bought?
Kaylis [27]
Well $16 times 16 would be $256.
If each shirt costs $1 then she could buy 16 shirts.
4 0
2 years ago
Read 2 more answers
Other questions:
  • This box has the same length , width, and height as the 2 basketballs. Which expression gives the volume of the empty space enci
    8·2 answers
  • Carbon–14 is a radioactive isotope that decays exponentially at a rate of 0.0124 percent a year. How many years will it take for
    14·1 answer
  • Jeremy walks into a video arcade with a pocketful of quarters. He spends them at a rate of four every quarter hour until he runs
    5·2 answers
  • From the following figure, how can you conclude that lines l and m are parallel?
    15·2 answers
  • Simplify sin θ / square root 1 - sin^2 θ
    11·1 answer
  • A white-tailed deer can sprint at speeds up to 30 miles per hour. American bison can run at speeds up to 3,520 feet per minute.
    13·2 answers
  • Kx = wv, solve for x? <br> algebra 1 honors^
    5·1 answer
  • Help me with this question please!
    10·2 answers
  • Match each set of points with the slope of the line formed by the ordered pairs.
    13·2 answers
  • Using the standard normal table, the probability that Seth’s light bulb will last no more than 14,500 (P(z ≤ 1.25)) hours is abo
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!