Lab Exercise Modify the following program with do-while loop to allow the user continuously input number1 and number2 un
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Lab Exercise Modify the following program with do-while loop to allow the user continuously input number1 and number2 un
Lab Exercise Modify the following program with do-while loop to allow the user continuously input number1 and number2 until the input number2 is not 0. import java.util.Scanner; class QuotientWithExcpetion { public static void main(String[] args) { Scanner input = new Scanner(System.in); // Prompt the user to enter two Integers System.out.print("Enter two integers: "); int number1= input.nextInt(); int number2 = input.nextInt(); I try block try! System.out.println(number1 + "/" + number2 + "Is + (number1 / number2)) 1 Il catch block catch (ArithmeticException e) { System.out.println("Exception caught: Division by zero."): System.out.println("Finish"); ha
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!