For this exercise, you are going to create a part of an Animal hierarchy. Unlike some...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
For this exercise, you are going to create a part of an Animal hierarchy. Unlike some of our examples and the previous exercises, this exercise is going to have 3 levels in the hierachry. At the top is the Animal class. Below that, we are going to have a subclass for Pets. Under pets, we are going to have 2 subclasses, Dogs and Fish. You will need to create your class hierarchy and add instance variables, getters, and setter methods to accommodate the following information: • I need to save what type of animal I have (String variable) • I want to be able to save a name for my fish and dog (String variable) • I want to know which fish need salt water v. fresh water (String variable) • I want to know if my dog has been trained (boolean variable) I want to know the size of my dog and fish (String variable) Make sure you use common sense names for your variables! public class Animal { } public class Fish extends Pet { } public class Pet extends Animal { } public class Dog extends Pet { } For this exercise, you are going to create a part of an Animal hierarchy. Unlike some of our examples and the previous exercises, this exercise is going to have 3 levels in the hierachry. At the top is the Animal class. Below that, we are going to have a subclass for Pets. Under pets, we are going to have 2 subclasses, Dogs and Fish. You will need to create your class hierarchy and add instance variables, getters, and setter methods to accommodate the following information: • I need to save what type of animal I have (String variable) • I want to be able to save a name for my fish and dog (String variable) • I want to know which fish need salt water v. fresh water (String variable) • I want to know if my dog has been trained (boolean variable) I want to know the size of my dog and fish (String variable) Make sure you use common sense names for your variables! public class Animal { } public class Fish extends Pet { } public class Pet extends Animal { } public class Dog extends Pet { }
Expert Answer:
Answer rating: 100% (QA)
Below is the code package inheritance Defines a class Animal class Animal Instance variable to store animal type String animalType Parameterized const... View the full answer
Related Book For
Data Analysis and Decision Making
ISBN: 978-0538476126
4th edition
Authors: Christian Albright, Wayne Winston, Christopher Zappe
Posted Date:
Students also viewed these computer engineering questions
-
For this assignment, you are going to create a communication with your clinic owner over an insurance providers attempt to negotiate ultrasound reimbursement rates. Your facility was about to raise...
-
You know that in one year you are going to buy a house. The annual interest rate for fixed-rate 30-year mortgages is currently 6.00%, and the price of the type of house you are considering is...
-
You are going to a dinner with three (3) friends, one who likes steak, another wine, and the third is a vegetarian (which is assumed to be the least expensive). Which is true? a. Equal sharing of the...
-
Pipestone Ltd. (Pipestone) uses an aging schedule to estimate the amount of receivables that won't be collected. Pipestone allows its customers up to 60 days to pay amounts owed. Any receivable...
-
Glossary Is a correction of an error in the financial statements considered an accounting change?
-
Each of three revolving doors has a perimeter of 6.60 m and revolves through a volume of 9.50 m 3 in one revolution about their common vertical side. What are the doors dimensions?
-
In a factory, 20 observations of the factors that could heat up a conveyor belt yielded the following...
-
In 2008 the Better Business Bureau settled 75% of complaints they received (USA Today, March 2, 2009). Suppose you have been hired by the Better Business Bureau to investigate the complaints they...
-
How many processes are created by the following program, including the initial process. (.5 Marks) #include #include int main() { int i; for (i=0; i <5; i++) fork(); return 0; ANSWER:
-
Bedco manufactures bed sheets and pillowcases which it supplies to a major hotel chain. It uses a just-in-time system and holds no inventories.The standard cost for the cotton which is used to make...
-
6. OABCDE is a regular hexagon and a, b denote respectively the position vectors of A, B with respect to O. (a) Show that OC = 2AB (b) Find the position vectors of C, D, and E In terms of a and b....
-
Explain how each of the following would affect the quantity of money demanded. Does the change cause a movement along the money demand curve or a shift of the money demand curve? a. Short-term...
-
Amaani Lyle, an African American woman, took a job as a scriptwriters assistant at Warner Brothers Television Productions. She worked for the writers of Friends, a popular, adult-oriented television...
-
Show the changes to the T-accounts for the Federal Reserve and for commercial banks when the Federal Reserve buys $50 million in U.S. Treasury bills. If the public holds a fixed amount of currency...
-
Rick Saldona began working as a traveling salesperson for Aimer Winery in 2009. Sales constituted 90 percent of Saldonas work time. Saldona worked an average of fifty hours per week but received no...
-
Dean Brothers Corp. owns and operates a steel-drum manufacturing plant. Lowell Wyden, the plant superintendent, hired Best Security Patrol, Inc. (BSP), a security company, to guard the property and...
-
An object of mass 125kg is released from rest from a boat intothe water and allowed to sink. While gravity is pulling the object?down, a buoyancy force of 1/50 times the weight of the object ispu 2...
-
One of the significant and relevant accounts for this cycle is equipment. For this account, what would typically be the most relevant assertions for the auditor to consider? Why is it important for...
-
The file S12_73.xlsx contains data on monthly U.S. permits for new housing units (in thousands of houses). a. Using Winters method, find values of , , and that yield an RMSE as small as possible....
-
The weekly demand function for one of a given firms products can be represented by q = 200 - 5p, where q is the number of units purchased (in hundreds) at price p (in dollars). Assume that the price...
-
The file S12_69.xlsx contains net sales (in millions of dollars) for Procter & Gamble. a. Use these data to predict Procter & Gamble net sales for each of the next two years. You need consider only a...
-
Make an energy diagram for gas B in Figure 20.4. Figure 20.4 When gases of different temperatures are placed in thermal contact, energy is transferred thermally from the hotter to the cooler gas...
-
Suppose you were to play the two film clips shown in Figure 20.7 backward. Would the resulting processes be possible? Figure 20.7 Quasistatic versus non-quasistatic expansion of a cylin- der...
-
(a) What are the SI units of \(Q\) ? (b) For the process depicted in Figure 20.2a, make an energy diagram for each of these systems: (i) water, pot, and flame; (ii) pot and flame; (iii) pot. Figure...
Study smarter with the SolutionInn App