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
Raoul has to finish a 473-page book in a week. He decides to read the same number of pages each weekday and 30 extra pages on Sa
hodyreva [135]

Answer:

59  pages

Step-by-step explanation:

Variable:

x = number of pages he has to read on a weekday

x + 30 = The number of pages read on Saturday and Sunday

5x+2(x+30) = 473

==> 5x + 2x + 60 = 473

==> 7x =413

==> x = 59

Meaning that Raoul has to read 59 pages on Wednesday

6 0
3 years ago
David rented a truck for one day. There was a base fee of $16.95 , and there was an additional charge of 98 cents for each mile
Nadusha1986 [10]
136.51=16.95+.98x

119.56=.98x

x=122
3 0
3 years ago
The cost of a canoe rental is $15 deposit plus $6 per hour.The total rental cost is​
Scrat [10]

Answer:

its 90

Step-by-step explanation:

3 0
3 years ago
If the total cost plus shipping is greater than $35,then you receive a 10% discount off the original selling price. Do you quali
RUDIKE [14]

<u>It's not clear what is the specific requirement of the question, but I'll assume a couple of situations to help you with your real problem.</u>

Answer:

$45 (qualified)

$30 (did not qualify)

Step-by-step explanation:

<u>Percentage Calculations</u>

Relative quantities are usually expressed as percentages (%). We say x percent of y is the proportion xy/100. When discounts or surcharges are applied, they are subtracted or added to the original quantity.

The question explains I receive a 10% discount off the original selling price if the total cost plus shipping is greater than $35. Let's assume the total cost plus shipping is $50. Since it's greater than $35, it qualifies for a discount. The discount is 10% of $50 = (10)(50)/100= $5. So the new total cost will be $50 - $5 = $45

Let's suppose now the total cost+shipping is $30. Since it's not greater than $35, no discount will be applied and we have to pay $30

7 0
3 years ago
Marist scholars ate a total of 16 bananas for snack. If the 34 kids in Bing-BU each ate a half of a banana for snack, which clas
LiRa [457]

Answer:

well 34/2= 17 so the kids in Bing-BU ate more total bananas

Step-by-step explanation:

4 0
3 years ago
Other questions:
  • Q(a+y)=67y+93 help me answer this
    12·1 answer
  • Choose the correct symbol for interval notation when a value is to be included in the solution.
    5·2 answers
  • Name the plane represented by the top of the box.
    6·1 answer
  • help me plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
    7·1 answer
  • A matched pairs design involves: matching pairs of participants based on a variable and then randomly assigning one member of ea
    14·1 answer
  • Please help this is due tomorrow us the screen shot
    10·1 answer
  • What is the area of the bedroom ?
    15·2 answers
  • Use the order of operations to evaluate the expression below.
    15·2 answers
  • If a bank represents deposits with positive numbers and withdrawals as negative numbers, what could 10 + (-60) represent?
    15·1 answer
  • Multiplying polynomials (x-4)^2
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!