Question: Also how do you handle division with zero in the denominator? (10p) 5. (a) Write down the Java code for an integer class Int that

Also how do you handle division with zero in the denominator?  Also how do you handle division with zero in the denominator?

(10p) 5. (a) Write down the Java code for an integer class Int that when executed sing this code Int 11 neu Int (5) Int 12 new Int (2); Int sum 11 plus (12); // sum -7 Int div- 11.div(12) // div - 2 if ( sum.isLargerThan (11) ) System.out printin("Sum is larger: "4sum.toString; if ( div.isEqualTo (12) ) System.out println("Both are equal"); else System.out.println("They are not equal"); results in the following console print-out Sum is larger: Int (7) Both are equal The methods in class Int should of course work properly for any type of integer vlues. Notice: We expect the Int class to contain at least a constructor and the methods plus, div, isLargerThan, isEqualTo, and toString. How do you handle division with zero in the denominator? (10p)

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!