Create a class named Rock that acts as a superclass for rock samples collected and catalogued by a natural history museum. The Rock class contains fields for a number of samples, a description of the...



Create a class named Rock that acts as a superclass for rock samples collected and


catalogued by a natural history museum. The Rock class contains fields for a number


of samples, a description of the type of rock, and the weight of the rock in grams.


Include a constructor that accepts parameters for the sample number and weight.


The Rock constructor sets the description value to Unclassified. Include get methods


for each field. Create three child classes named IgneousRock, SedimentaryRock, and


MetamorphicRock. The constructors for these classes require parameters for the


sample number and weight. Search the Web for a brief description of each rock type


and assign it to the description field. Create an application that instantiates an object


of each type and demonstrate that the methods work appropriately. Save the files as


Rock.java, IgneousRock.java, SedimentaryRock.java, MetamorphicRock.java,


and DemoRocks.java.



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here