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
stepladder [879]
2 years ago
8

In Java, a reference variable is ________ because it can reference objects of types different from its own, as long as those typ

es are related to its type through inheritance.
Computers and Technology
1 answer:
grandymaker [24]2 years ago
5 0

Answer:

polymorphic

Explanation:

An example of polymorphic reference, suppose you have 3 classes: Main, Product and SpecificProduct. If SpecificProduct extends Product this means it is a product class but with something else to complement.

Say you want to reference an object of product in the main class, you can do it the classic way:

Product pd = new Product();

Or you can do it polymorphic, like this:

Product pd = new SpecificProduct();

The program will accept just fine because SpecificProduct is extending Product. When you do it like this, we say the reference you made was a polymorphic reference

You might be interested in
Before you begin entering data in a worksheet, you should create a _____ for the worksheet.
DIA [1.3K]

Answer:

I'm pretty sure the answer is Template, But if I'm wrong sorry

Explanation:

3 0
3 years ago
Read 2 more answers
_______ are malicious programs that come into a computer system disguised as something else such as a free computer game or scre
Lady_Fox [76]

Answer:

Trojan horses

Explanation:

4 0
2 years ago
Which statement below is incorrect when discussing communication in the online community?
Marysya12 [62]
It's everyone's responsibility to report cyberbullying.

The tone is important whenever you are talking to someone else.

You can literally say anything in virtual world, but you should behave yourself

If everybody knows the common text phrases, then it's fine, but it will be better to talk formally.
8 0
3 years ago
What is the molar mass of AuCI2
andriy [413]

Answer:267.8726

Explanation:

5 0
3 years ago
Construct a class that will model a quadratic expression (ax^2 + bx + c). In addition to a constructor creating a quadratic expr
stich3 [128]

Answer:

Following are the code to this question:

#include <iostream>//header file

#include<math.h>//header file

using namespace std;

class Quadratic//defining a class Quadratic  

{

private:

double a,b,c;//defining a double variable

public:

Quadratic()//defining default constructor

{

a = 0;//assigning value 0  

b = 0;//assigning value 0  

c = 0;//assigning value 0  

}

Quadratic(double a, double b, double c)//defining a parameterized constructor  

{

this->a = a;//use this keyword to hold value in a variable

this->b = b;//use this keyword to hold value in b variable

this->c = c;//use this keyword to hold value in c variable

}

double getA() //defining a get method  

{

return a;//return value a

}

void setA(double a)//defining a set method to hold value in parameter

{

this->a = a;//assigning value in a variable

}

double getB() //defining a get method  

{

return b;//return value b

}

void setB(double b)//defining a set method to hold value in parameter  

{

this->b = b;//assigning value in b variable

}

double getC() //defining a get method

{

return c;//return value c

}

void setC(double c)//defining a set method to hold value in parameter

{

this->c = c;//assigning value in c variable

}

double Evaluate(double x)//defining a method Evaluate to hold value in parameter

{

return ((a*x*x)+(b*x)+c);//return evaluated value

}

double numberOfReal()//defining a method numberOfReal to calculates the real roots

{

return (b*b)-(4*a*c);//return real roots

}

void findroots()//defining a method findroots

{

double d=numberOfReal();//defining double variable to hold numberOfReal method value

if(d<0)//use if block to check value of d less than 0

cout<<"Equation has no real roots"<<endl;//print message

else

{

double r1=(-b+sqrt(numberOfReal()))/(2*a);//holding root value r1

double r2=(-b-sqrt(numberOfReal()))/(2*a);//holding root value r2

if(r1==r2)//defining if block to check r1 equal to r2

cout<<"Equation has one real root that is "<<r1<<endl;//print message with value

else//else block

cout<<"The equation has two real roots that are "<<r1<<" and "<<r2<<endl;////print message with value

}

}

void print()//defining a method print  

{

cout<< a << "x^2 + " << b << "x + " << c <<endl;//print Quadratic equation

}

};

int main()//defining main method  

{

Quadratic q(5,6,1);//creating Quadratic class object that calls parameterized constructor

q.print();//calling print method

cout<<q.numberOfReal()<<endl;//calling method numberOfReal that prints its value

q.findroots();//calling method findroots

cout<<q.Evaluate(-1);//calling method Evaluate that prints its value

return 0;

}

Output:

5x^2 + 6x + 1

16

The equation has two real roots that are -0.2 and -1

0

Explanation:

In the above code, a class "Quadratic" is declared, which is used to define a default and parameter constructor to holds its parameter value.

In the next step, the get and set method is defined that holds and returns the quadratic value, and "Evaluate, numberOfReal, findroots, and print" in the evaluate method a double variable is used as a parameter that returns evaluated value.

In the "numberOfReal" method it calculates the real roots and returns its value. In the "findroots" method a double variable "d" is declared that hold "numberOfReal" value,

and use a conditional statement to check its value, and in the print method, it prints the quadratic equation.

In the main method, the lass object it calls the parameterized constructor and other methods.

5 0
3 years ago
Other questions:
  • Mobile Device Company (MDC) discovers that defamatory statements about its policies and products are being posted in an online f
    8·1 answer
  • If you want to refine your google search results by date, which option should you use?
    10·1 answer
  • If a computer is capable only of manipulating and storing integers, what di themselves? How are these difficulties overcome
    13·1 answer
  • A group of students want to create an educational online game for computer laboratory in their school which type of network will
    6·1 answer
  • The list below show test scores for 3rd period on a recent test.
    13·1 answer
  • John works as an associate at a construction company. His job is to draft contracts for suppliers. Before he prints the contract
    7·1 answer
  • ______ databases find the name and department name of all graduate students who work on projects that do not employ any other gr
    9·1 answer
  • Who wants brainliest? First to answer gets it....
    12·2 answers
  • Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as t
    14·1 answer
  • Two negative reviews and no positive reviews is enough to consider the website to have a negative reputation.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!