Describe how you would develop object-oriented features of Java for the Quiz program developed in the Programming Assignments. In particular, describe how the program could use each of the following: class variables, instance variables, inheritance, polymorphism, abstract classes, "this", "super", interfaces, and event listeners.
In: Computer Science
5) Consider the hierarchy of classes shown for a small part of a bird sanctuary.
Notice that an Owl is-a Bird, a SnowyOwl is-a Owl, and an ElfOwl is-a Owl.
The class Bird is specified as an abstract class as shown in the following implementation. Each Bird has a name and a noise that are specified when it is constructed.
public abstract class Bird
{
private String name;
private String noise;
/** Constructor for objects of class Bird */
public Bird(String birdName, String birdNoise)
{
name = birdName;
noise = birdNoise;
}
public String getName() { return name; }
public String getNoise() { return noise; }
public abstract String getFood();
}
An Owl is-a Bird whose noise is “hoot”. The food it eats depends on the type of Owl, which means that getFood cannot be implemented in the Owl class. Here is the implementation for the Owl class.
public abstract class Owl extends Bird
{
//Constructor
public Owl(String owlName)
{ super(owlName, “hoot”); }
}
5a) A SnowyOwl is-a Owl whose name is always “Snowy owl”. A SnowyOwl will randomly eat a hare, a lemming, or a small bird (depending on what’s available!), where each type of food is equally likely. The SnowyOwl class should use a random number to determine which food the SnowyOwl will eat. Assuming that the Owl class has been correctly defined, and given the class hierarchy shown previously, write a complete declaration of the class SnowyOwl, including implementation of the constructor and method(s).
5b) Consider the following partial declaration of class BirdSanctuary.
public class BirdSanctuary
{
/**The list of birds */
private Bird[] birdList;
/** Precondition: Each Bird in birdList has a getFood method
* implemented for it
* Postcondition: For each Bird in the birdList array, its name,
* followed by the result of a call to its getFood method has
* been printed, one line per Bird
*/
public void allEat()
{ /* to be implemented in this part */ }
//The constructor and other methods are not shown.
}
Write the BirdSanctuary method allEat. For each Bird in BirdSanctuary, allEat prints a line with the name of the Bird followed by the result of a call to its getFood method, one line per Bird.
In: Computer Science
Draw a layout for Micro-Electro Mechanical Systems (MEMS) pressure sensore. For each layer, indicate it using a different color. Also, mention the dimensions.
In: Electrical Engineering
What has been the effect of COVID-19 on the United States' GDP, unemployment, and inflation? please mention the sequence of events and conclusion of all three
In: Economics
Please mention 10 (ten) differences in nature, function and characteristics between Consumer & Business Markets (bullet points).
Minimum Requirement : 250 Words
In: Economics
Compare and contrast 10 structural and genetic characteristics that distinguish between “Prokaryotic” and Eukaryotic cells. Be sure to define/describe the significance of the characteristics that you mention.
In: Biology
1) Mention at least 3 reasons why a company has cash balances.
2) Explain what and how the concepts of work:?
"Lockbox"?
"Float"?
In: Accounting
Mention four real and different cases in which a fair solution was reached after the seller was unable to deliver the goods to the buyer due to the Corona crisis?
In: Economics
Mention any two external conditions that could affect the Water Sprinkler?
List any two smart products available use water efficiently ?
In: Anatomy and Physiology
In: Anatomy and Physiology