Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Intro JAVA class very basic understanding and basic functions Write a Java application that asks the user to enter two integers, obtains them from the

Intro JAVA class very basic understanding and basic functions

Write a Java application that asks the user to enter two integers, obtains them from the user and prints their sum, product, difference and quotient (division). Use the techniques shown in Fig. 2.7 Call your file Calculate.java. image text in transcribed

Then surround your code in try/catch/ block. The try should be enclosed within a do while loop. Capture both the arithmetic exception, input exception using separate catch statements.

I // Fig. 2.7: Addition.java 2 // Addition program that inputs two numbers then displays their sum 3 import java.util.Scanner; // program uses class Scanner 5 public class Addition // main method begins execution of Java application public static void main(String [] args) 8 // create a Scanner to obtain input from the command window Scanner input new Scanner (System.in) 12 14 15 int number1; // first number to add int number2; // second number to add int sum; // sum of numberl and number2 System.out.print("Enter first integer:";// prompt number1input.nextIntO // read first number from user 20 21 System.out.print("Enter second integer::I7prompt number2input.nextIntO; // read second number from user 23 sum numberl number2; // add numbers, then store total in sum display 25 26 27 System.out.printf("Sumis %d%n", sum); // sum // end method main // end class Addition Enter first integer: 45 Enter second integer: 72 Sum is 117

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

Analyse the various techniques of training and learning.

Answered: 1 week ago