Answered step by step
Verified Expert Solution
Question
1 Approved Answer
# 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started