Question: # 1 . / / createarray. / / # 4 ) ( CHAP 7 ) ( 1 0 pts ) Create an array or ArrayList
# createarray. #CHAP pts Create an array or ArrayList of your superclass fromYou cannot hardcode the input have the user choose which subclass toand then create it and add it to array. Add at least items to the Here in this main method, print out what is in the array! #CHAP pts Use a custom exception in your code for example,you add a characteristic and it is invalid, then let user know.Somethang LiKe Evatadvalue" the Lndicates the user put or example,that indicates the user put in anegative valueor something invalidHERE in this main method, print out an example of creating an instanceof one of the subclasses in # with an invalid value that causes theexceptionto be thrown HINT: a good place to put this check is in theCONSTRUCTORCatch the exception HERE in the main method so your program doesn't endyet!To get full credit, you must catch the error and then let the userenter agood value
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
