[SOLVED] ECE325 Assignment7 Type Compatibility and Generics

19.99 $

Category:

Description

5/5 - (1 vote)

 

In this assignment, you should submit three Java files for Question 1 and 2:ArrayExample.java,ArrayExam andArrayListExample.java. For Question 3 the “difficult question”, you should submit a folder that contains all modified files.

These questions use a hierarchy of classes of simple geometric objects:

·GeometricShape.java

·TwoDShape.java

·ThreeDShape.java

·Circle.java

·Cone.java

·Rectangle.java ·Sphere.java

Test.javais a little test class that you can run to make sure the other classes are working.

1. Java Arrays and Type Compatibility Rules

Look at the skeleton for the main method inArrayExample.java. Add some additional statements to it so that the code compiles correctly, and when it is run, it raises

a java.lang.ArrayStoreException when adding a cone to geoshapes (Adding a circle should be OK). Here is the exception you should get: