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
goldenfox [79]
3 years ago
15

If I have an Animal superclass with a Mammal subclass, both concrete and both having a method called eat() with identical signat

ures and return types, polymorphism means:________.
a. the Animal version of eat() will be called, regardless of the static/dynamic type.
b. the Mammal version of eatſ) will be called, regardless of static/dynamic.
c. the dynamic type of the reference will determine which of the methods to call.
d. the static type of the reference will determine which of the methods to call.
Computers and Technology
1 answer:
Katarina [22]3 years ago
5 0

Answer:

(c) the dynamic type of reference will determine which of the methods to call.

Explanation:

Polymorphism in Object Oriented Programming typically means the same method name can cause different actions depending on which object it is invoked on. Polymorphism allows for dynamic binding in that method invocation is not bound to the method definition until the program executes.

So in the case of Animal superclass and Mammal subclass, both having a method called eat() with identical signatures and return types, depending on which reference, the correct method eat() will be called dynamically upon execution.

For example, if we have the following;

================================

<em>Mammal mammal = new Animal();</em>

<em>mammal.eat()</em>

================================

The eat() method that will be called is the one in the Mammal subclass.

However, if we have;

================================

<em>Animal animal = new Animal();</em>

<em>animal.eat()</em>

================================

The eat() method of the Animal superclass will be called.

You might be interested in
Write a program that asks a user to enter a date in month day year format (for example 10 12 2016) and displays the day of the w
AleksAgata [21]

Answer and Explanation:

Using javascript:

function dayof_theweek(){

var TodayDate = window. prompt("enter today's date in the format 'year, month, day' ");

var Datenow=new date(TodayDate);

var Dayofweek=Datenow.getday();

var Days=["monday","Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];

if(Dayofweek==indexOf(Days[Dayofweek]))

{

document.createTextnode(Days[Dayofweek]);

}

}

The program above uses a date object which uses the method getday to get the day of the week(get day returns an integer from 0 to 6).we then use a comparison operator == to test the condition that returned value Dayoftheweek is same with the index of the array Days and then print to a html document. The program may need improvements such as the fact that errors may arise when proper input isn't given, and therefore must be handled.

8 0
2 years ago
Use the arr field and mystery () method below.
kolezko [41]

Answer:

The sum of all positive even values in arr

Explanation:

We have an array named arr holding int values

Inside the method mystery:

Two variables s1 and s2 are initialized as 0

A for loop is created iterating through the arr array. Inside the loop:

num is set to the ith position of the arr (num will hold the each value in arr)

Then, we have an if statement that checks if num is greater than 0 (if it is positive number) and if num mod 2 is equal to 0 (if it is an even number). If these conditions are satisfied, num will be added to the s1 (cumulative sum). If num is less than 0 (if it is a negative number), num will be added to the s2 (cumulative sum).

When the loop is done, the value of s1 and s2 is printed.

As you can see, s1 holds the sum of positive even values in the arr

7 0
2 years ago
1
raketka [301]

1

they were crafted in stained-glass art in religious buildings

2

puzzle games

3

motion-capture devices (e.g., Kinect, WiiMote

4

puzzle

simulation

5 0
3 years ago
Natalie wants to create a database to collect information about sales transactions. She would like to use the database to look u
Lynna [10]

Answer:

Customer Table

  1. Customer name
  2. Customer id

Product Table

  1. Product id/number (primary key, auto increment)
  2. Product name
  3. Product sale price

Transactions Table

  1. Transaction Id
  2. Customer Id
  3. Product id
  4. Quantity
  5. Price
  6. Date

Explanation:

Natalie wants to fetch following information from database

  1. Look up customer name and sale price
  2. Sort items in db by product number

To lookup customer name and sale price perform a join on Transactions table and Customer table.Assuming database is build in mysql the query to fetch required results would be

select transction.productId,transaction.customerid,customer.customername from transactions join customer ON

customer.customerid=transcation.customerid

where productid="user provided product id of returned product"

For sorting products by number set produc number in product table a auto increment primary key

7 0
3 years ago
The ______ clause allows us to select only those rows in the result relation of the ____ clause that satisfy a specified predica
baherus [9]

Answer:

1. Where,

2. From

Explanation:

In SQL query language when working on a database, a user can use certain clauses to carry out some functions.

Hence, The WHERE clause allows us to select only those rows in the result relation of the FROM clause that satisfy a specified predicate.

This is because the "Where clause" selects the rows on a particular condition. While the "From clause" gives the relation which involves the operation.

5 0
2 years ago
Other questions:
  • A software programâs _________ indicates what can legally be done with that program.]
    5·1 answer
  • You want to discard your old computer and want to securely erase the data from your hard drive. What can you use to do this and
    6·1 answer
  • Why should the data in a reservation system that is constantly being updated be stored on a magnetic disk instead of a CD or DVD
    15·1 answer
  • What do you do to add a line or circle to your presentation?
    7·2 answers
  • The___ allows you quickly access features such as formatting, charting, tables, and totals
    11·1 answer
  • Write a method called removeHighPrice that will go through a provided ArrayList called prices and removes the first price that i
    6·1 answer
  • The cameras picture review function allows you to look at the _ you've taken
    8·1 answer
  • Some people recommend deleting social media accounts because of the troubling legal and ethical implications of social media. Do
    9·1 answer
  • How do I get the pictures from my old Samsung phone to put on my iPhone? The Samsung is turned off. Is there a way to transfer i
    8·1 answer
  • . Imagine that you were programming without an IDE. What problems might you encounter?​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!