Question: Write a java program to implement a calculator for operating on arrays. Calculator -arr1: int array -arr2: int array -length: int +Calculator(int) +Calculate(Calculator obj, char

Write a java program to implement a calculator for operating on arrays.

Calculator

-arr1: int array

-arr2: int array

-length: int

+Calculator(int)

+Calculate(Calculator obj, char c): int[]

+inputArr1():void

+inputArr2():void

+Getters and setters.

You need to create an object from the Calculator class in your test class. Then, you need to fill arrays of the object with the user inputs. Then, you need to take and operator from the user to define which operations to be done. It is needed to do exception handing for same cases: IndexOutOfBounds exception: Inside InputArr1() and InputArr2() functions, you need to make sure that arrays are not going out of bounds by handling the IndexOutOfBounds exception. NumberFormatException: Inside InputArr1() and InputArr2() functions, you need to check if inputs are in correct format(integer). Arithmetic Exception: Inside Calculate() function, you need to handle arithmetic exception in case a number is divided by zero. Throw Exception: Inside Calculate() function, you need to check if arrays lengths are equal. If they are not the equal, then you need to throw an exception. In your test class there will be a menu driven process that program will contuniue as long as user does not input exit

 Write a java program to implement a calculator for operating on

length of first number set: 4 25 24 35 58 1st set entered: 25 24 35 58 length of second number set: 4 5 6 45 29 2nd set entered: 5 6 45 29 choose operation: + 30 30 80' 87 choose operation: - 20 18 -10 29 choose operation: * 125 144 1575 1682 choose operation: / 5 4 0.777778 2 choose operation: exit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!