Question: (Java) Help with checking for invalid input using try and catch. Looking for help adding the try and catch in my code to check for

(Java) Help with checking for invalid input using try and catch.

Looking for help adding the try and catch in my code to check for zero, negative numbers, and letters.(Java) Help with checking for invalid input using try and catch. Looking

File Edit source Refactor Navigate Searth Project Rui Window Help A My FirstClass lava la 1 import java util Scanner 2 publ class HyFirstriass 3e public static void main string args) 4 Creating an array for user entered weights and declaring some variables 5 ble rd Weight new bleL5 6 int i; otalHeigh double t 8 ble avrrageel ight a; 9 ble nexWeight 0; 10 Syst 13 for (i 0; i i Taking 5 weieht inputs tror user and putting it in array 15 entered eights[i next Double 17 nt Statement for all user entered Wrights LE System.out.print nter weight (i 1 ln 19 Calculating total weight 21 totalnleight entered Weights[i 22 24 if(entere eights [i] maxWeight) maxweight entered Heights 28 System.out print You entered //Printing all 5 user entered weights 31 for (i 92 Syst out-p entered eights Print 34 Calculating Average Weigh 35 average Weight Wright)/5.6 Print Statenents or total, average and max Heights 31 Systel ut.p 3g System.out.print WnTotel height: totalleight); ln 4e Average weight average eight); 41 Syst print in("Max ght maxle ight return 47 ust v 8, My FirstClass mainstringal Void

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!