1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
SashulF [63]
3 years ago
12

A bear is an animal and a zoo contains many animals, including bears. Three classes Animal, Bear, and Zoo are declared to repres

ent animal, bear and zoo objects. Which of the following is the most appropriate set of declarations?
a) public class Animal extends Bear
{
...
}
public class Zoo
{
private Animal[] myAnimals;
...
}
b) public class Animal extends Zoo
{
private Bear myBear;
...
}
c) public class Bear extends Animal, Zoo
{
...
}
d) public class Bear extends Animal implements Zoo
{
...
}
e) public class Bear extends Animal
{
...
}
public class Zoo
{
private Animal[] myAnimals;
...
}
Computers and Technology
1 answer:
givi [52]3 years ago
7 0

Answer:

a) public class Bear  extends Animal{ ... }

public class Zoo {  private Animal[] myAnimals;

... }

Explanation:

The question is an illustration of inheritance in Java programming language.

The syntax to follow is:

class subclass extends superclass {...}

From the question:

Bear \to subclass

Animal \to superclass

So, the following declaration will be used:

class Bear  extends Animal{ ... }

Also from the question, the zoo object represents collection of many animals.

So, its declaration will follow:

class class-name{ ..... }

i.e.

class zoo{ .... }

The ... can then be replaced with declaration of each animal or an array to represent the declarations..

<em>Hence, (e) is correct</em>

You might be interested in
given an array of integers a, your task is to count the number of pairs i and j (where 0 ≤ i &lt; j &lt; a.length), such that a[
Nimfa-mama [501]

Using the knowledge of computational language in C++ it is possible to write a code that given an array of integers a, your task is to count the number of pairs i and j.

<h3>Writting the code:</h3>

<em>// C++ program for the above approach</em>

<em> </em>

<em>#include <bits/stdc++.h></em>

<em>using namespace std;</em>

<em> </em>

<em>// Function to find the count required pairs</em>

<em>void getPairs(int arr[], int N, int K)</em>

<em>{</em>

<em>    // Stores count of pairs</em>

<em>    int count = 0;</em>

<em> </em>

<em>    // Traverse the array</em>

<em>    for (int i = 0; i < N; i++) {</em>

<em> </em>

<em>        for (int j = i + 1; j < N; j++) {</em>

<em> </em>

<em>            // Check if the condition</em>

<em>            // is satisfied or not</em>

<em>            if (arr[i] > K * arr[j])</em>

<em>                count++;</em>

<em>        }</em>

<em>    }</em>

<em>    cout << count;</em>

<em>}</em>

<em> </em>

<em>// Driver Code</em>

<em>int main()</em>

<em>{</em>

<em>    int arr[] = { 5, 6, 2, 5 };</em>

<em>    int N = sizeof(arr) / sizeof(arr[0]);</em>

<em>    int K = 2;</em>

<em> </em>

<em>    // Function Call</em>

<em>    getPairs(arr, N, K);</em>

<em> </em>

<em>    return 0;</em>

<em>}</em>

See more about C++ code at brainly.com/question/17544466

#SPJ4

4 0
1 year ago
Implement the function calcWordFrequencies() that uses a single prompt tonread a list of words (separated by spaces). Then, the
Morgarella [4.7K]
The function it puts those consoles
4 0
4 years ago
What is a industrial engineer?​
Eddi Din [679]

Answer:

Industrial Engineers develop job evaluation programs and find ways to elimimate wastefulness in productions.

3 0
3 years ago
What is meant by key distribution center ( KDC)?
erastovalidia [21]

Answer: A. A method of access control that allows a user to log on to a system and gain access to other resources within the network via the initial logon

Explanation: key distribution center ( KDC) is a system that is used to provide access to a particular network user who shares data which are either private or regarded as sensitive.

It is a form of encryption that allows multiple system within the same network through the use of uniquely secured tickets used to setup a secure connection which gives room for data to be shared.

KDC makes use of cryptographic techniques to prove the validity of a user and grants a ticket permission access. The user present the ticket of permission to the system which then validates it and grant access to the user.

Example of security system that adopts KDC include kerberos.

4 0
3 years ago
6. Assume a processor supports all instructions and addressing modes. A program consists of 25% store words, 15% load words, 10%
Sloan [31]

Answer:

After checking the attached picture, come to this calculated "Total Time".

Total time 'T'

T = (0.25)(200) + (0.15)(200) + (0.1)(250) + (0.05)(175) + (0.45)(75)

T = 147.5 ps

8 0
3 years ago
Other questions:
  • Which of these is outside the scope of an art director's responsibility?
    12·2 answers
  • for what reason do some security professionals consider insiders more dangerous than outside intruders?
    8·1 answer
  • Communication is used to satisfy instrumental goals, which means ________ .
    5·2 answers
  • If you decide to get married, a trade-off would be that you have to give up being single.
    12·2 answers
  • What effect on total current flow will a shorted series component have in a series-parallel circuit?
    8·1 answer
  • A nonprofit organization uses a contact management database to track donations, amounts donated, and all correspondence and phon
    11·1 answer
  • Please describe the role of games in modern society!
    15·2 answers
  • 13) An-Excel-file-is-generally called-a-l-an:
    6·1 answer
  • During the data transmission there are chances that the data bits in the frame might get corrupted. This will require the sender
    8·1 answer
  • The output of a computer can be seen on ( monitor, keyboard or mouse )​
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!