Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Modify Existing Java Program using Exception Handling

kkrenichen
kkrenichen 


Modify any one (your choice) of the existing programs from Exception handling zip file and write out detail comments, the programs purpose and programmer information. Write in detailed notes/comments on what has been modified/customized. Attachments Tags Clarifications

Answers

Modify Exception Handling

mariobeka
mariobeka 



Here I modified the DivisionMistakeCaught. Where I generate a random array with denominators with the user specifying its size. And then try to divide 10 with any random denominator in
the array. The program will throw an exception if in the array will be found a
0. Also I changed the result, making it more precise by converting the type from int to double.
Attachments
DivisionMistakeCaught.java (2 K) Download Preview
* * @param min The minimum range. * @param max The maximum range. * @return A random integer number */ public static int getRandomNumberFrom(int min, int max) { Random r = new Random(); int randomNumber = r.nextInt((max + 1) - min) + min;

Screen Shot 2015-12-07 at 16.57.45.png (35 K) Download Preview

Screenshots
Screenshot
Purchase Answer