Create a class named Rock that acts as a superclass for rock samples collected and catalogued by
Question:
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 Internet 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.
Step by Step Answer:
public class Rock private int sampleNumber private String description private double weight public R...View the full answer
Students also viewed these Computer science questions
-
a. Create a class named Lease with fields that hold an apartment tenants name, apartment number, monthly rent amount, and term of the lease in months. Include a constructor that initializes the name...
-
a. Create a class to hold data about a high school sports team. The Team class holds data fields for high school name (such as Roosevelt High), sport (such as Girls Basketball), and team name (such...
-
a. Create a class named Circle with fields named radius, diameter, and area. Include a constructor that sets the radius to 1 and calculates the other two values. Also include methods named...
-
Monochromatic light from a distant source is incident on a slit 0.750mm wide. On a screen 2.00 m away, the distance from the central maximum of the diffraction pattern to the first minimum is...
-
During August 2010, Madeline invests $400,000 in Qual Company, Inc., buying 100,000 shares of stock. Her broker tells her this will be an excellent investment because the securities are qualified...
-
What is meant by the "bag" assumption and why is it necessary in a multiproduct firm? What additional assumption must be made in multiproduct CVP analysis that doesn't pertain to a single-product CVP...
-
The simplest form of mass matrix is known as a. lumped-mass matrix b. consistent-mass matrix c. global mass matrix
-
Summarize how the electron transport chain functions to produce ATP in a bacterial cell versus a eukaryotic cell. Explain whether or not the term chemiosmosis accurately illustrates this process.
-
How does the perception of organizational justice affect employee motivation and job satisfaction, and what can organizations do to promote a sense of fairness and equity ?
-
Wayland Custom Woodworking is a firm that manufactures custom cabinets and woodwork for business and residential customers. Students will have the opportunity to establish payroll records and to...
-
Create a class named CollegeCourse that includes data fields that hold the department (for example, ENG), the course number (for example, 101), the credits (for example, 3), and the fee for the...
-
Develop a set of classes for a college to use in various student service and personnel applications. Classes you need to design include the following: PersonA Person contains a first name, last name,...
-
Bloom Orchards produced a good crop of peaches this year. After preparing the following income statement, the company believes it should have given its No. 3 peaches to charity and saved its efforts....
-
July 12 Sold merchandise to Wally Butler, who paid the $1,060 purchase with cash. The goods cost Evergreen Company $630. July 15 Sold merchandise to Claudio's Chair Company at a selling price of...
-
Randall Company manufactures products to customer specifications. A job costing system is used to accumulate production costs. Factory overhead cost was applied at 125% of direct labor cost. Selected...
-
1. You want to build a CRR binomial model to value options on Moderna (MRNA). The current stock price of MRNA is 310.20. Assume the volatility of MRNA is 61.2% (annual) and the risk-free interest...
-
Luis is an instructor at the Harrisonburg Automotive Mechanic School, where he leads the program in charge of automotive technicians. Currently, Luis is trying to arrange for the restoration of a...
-
Jefferson Products, Inc., is considering purchasing a new automatic press brake, which costs $320,000 including installation and shipping. The machine is expected to generate net cash inflows of...
-
What might explain why TFP differs so much across countries?
-
If a test has high reliability. O the test measures what the authors of the test claim it measures O people who take the same test twice get approximately the same scores both times O scores on the...
-
When users can initiate actions by clicking the mouse on an icon, the program is ___________ -driven. a. Command b. Prompt c. Event d. Incident
-
Compared to using a command line, an advantage to using an operating system that employs a GUI is __________. a. You can interact directly with the operating system b. You do not have to deal with...
-
Complete the following tasks: a. Create a class named Trip that includes four string variables: destination (for example, London), means of transportation (for example, air), departure date (for...
-
Jane Harper was 50 years old when one morning she slipped and fell down a flight of stairs leading from her apartment to the parking lot. The ice and snow had accumulated on the stairs and other...
-
During a domestic quarrel a wife continually taunted her husband by degrading him and telling him he was a "lousy lover" and that she wanted to be rid of him. When the husband tried to persuade her...
-
Mr. Andrews (age 75) taught poetry in the Cook County school district. He is recently widowed, his wife having passed away a year ago after a lengthy illness; she had breast cancer for the last five...
Study smarter with the SolutionInn App