Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need solution as soon as possible 1. a, b, and c are the three numbers and the following code is written by a Java Programmer.

image text in transcribed

need solution as soon as possible

1. a, b, and c are the three numbers and the following code is written by a Java Programmer. public class Test{ public static void main(String[] args) { int a= 20; int b = 30; int c = 10; int x = (a*b)/(a - b + c); System.out.println("Result:" +x); 3 } i) ii) iii) a a iv) v) What will be the potential problem if you execute the program? If you want to execute the print statement irrespective of the problem, how can you do that? Now Design a Class TestABC with a method testABCValid( that returns true if it satisfies the criteria of a valid denominator. Write down a method throwPotentialException() that uses the testABCValid() and throws DenominatorException as described below. Your own Exception class DenominatorException will throw an Exception if the valid denominator criteria is not satisfied with the information of "Not a correct Denominator" with the values of a, b and c. A Quotient can be only instantiated with the value of numerator and denominator (if valid) otherwise an exception will be thrown. Now design a new Driver Class that will get the values of a, b and c from the user. He can enter the values multiple times until the given values satisfy the valid denominator. Finally print out the quotient. vi) vii)

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_2

Step: 3

blur-text-image_3

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

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions

Question

EXPLAIN the six steps in the termination interview.

Answered: 1 week ago

Question

3 How the market system answers four fundamental questions.

Answered: 1 week ago