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
viva [34]
3 years ago
11

Design a class named QuadraticEquation for a quadratic equation ax^2+bx+x=0. The class contains: **private data fields a, b, and

c that represents three coefficients. **a constructor for the arguments for a, b, and c. **three get methods for a, b, and c. **a method named getDiscriminant() that returns the discriminant, which is b2-4ac **the methods named getRoot1() and getRoot2() for returning two roots of the equation, or returning 0 if the discriminant is negative.[/color]
Computers and Technology
1 answer:
LenaWriter [7]3 years ago
4 0

Answer:

<em>C++</em>

///////////////////////////////////////////////////////////////////////////////////////////

#include <iostream>

using namespace std;

//////////////////////////////////////////////////////////////////

class QuadraticEquation {

   int a, b, c;

   

public:

   QuadraticEquation(int a, int b, int c) {

       this->a = a;

       this->b = b;

       this->c = c;

   }

   ////////////////////////////////////////

   int getA() {

       return a;

   }

   

   int getB() {

       return b;

   }

   

   int getC() {

       return c;

   }

   ////////////////////////////////////////

   // returns the discriminant, which is b2-4ac

   int getDiscriminant() {

       return (b*2)-(4*a*c);

   }

   

   int getRoot1() {

       if (getDiscriminant() < 0)

           return 0;

       else {

           // Please specify how to calculate the two roots.

           return 1;

       }

   }

   

   int getRoot2() {

       if (getDiscriminant() < 0)

           return 0;

       else {

           // Please specify how to calculate the two roots.

           return -1;

       }

   }

};

//////////////////////////////////////////////////////////////////

int main() {

   return 0;

}

You might be interested in
Which of the following is an external hard drive
fredd [130]

Answer:

Question 1 = D

Explanation:

7 0
3 years ago
Which of these is not considered a final step when creating a Podcast? Getting a loan to help with the cost of the equipment. Ch
Neporo4naja [7]

Answer:

Option 1

Explanation:

Ok first off if your taking out a loan for your podcasting thats a issue. The other options are what you would normally do when setting it up because chances are you have the equipment necessary to start the podcast.

Hope this helps:)

6 0
2 years ago
In a linked chain implementation of a stack ADT the performance of popping am emtry from the stack is
Mice21 [21]

Answer:

B.O(1)

Explanation:

When we are implementing ADT stack using linked chain we can pop an entry from the stack having O(1) time complexity because in linked chain we have the head or top pointer in linked chain only.Popping and pushing in stack happens on only one end that is top.So we have move to move top in linked chain to the next and delete prev node.

8 0
3 years ago
Scanner can be used to read tokens from a String literal Scanner can be used to read tokens from the console window (user input)
Paladinen [302]

Answer:

Scanner can be used to read tokens from the console window (user input)

Explanation:

Scanner is a class used in some programming languages to obtain inputs from users.

It is mostly well developed in Java programming language and used exclusively for taking and obtaining inputs.

Scanner takes input in primitive types such as doubles, floats and integers. IT also takes string inputs.

Here is a code snippet where the class scanner is used:

         Scanner input = new Scanner (System.in)

The code above creates an object of the scanner class

7 0
3 years ago
When you hide a worksheet, its ______ disappears, however the worksheet itself remains part of the workbook until you select to
Reptile [31]
Cell is the possible answer
8 0
2 years ago
Other questions:
  • What will happen if Sam goes to the View menu, clicks Toolbars, and then clicks Picture?
    12·2 answers
  • The most common types of utility programs fall into these categories. accessibility calculation communication data entry enterta
    6·2 answers
  • Which of the following is not given to a client computer when it is first installed on a TCP/IP network so that it has the appro
    9·1 answer
  • I don't know how to explain what is motion in my own words
    7·2 answers
  • What is the purpose of "display:table"?
    10·1 answer
  • The range of a finite nonempty set of $n$ real numbers $S$ is defined as the difference between the largest and smallest element
    15·1 answer
  • b. Write a complete program for the following situation related to setting the speed of a car to preset values before starting a
    5·1 answer
  • How to calculate 3 X (50 + 40) ÷ 5 on excel 2016
    14·2 answers
  • Which of the following shows data conversion taking place?
    12·1 answer
  • 1.Know the BMI of the user. First, the user will input the height in meters and weight in kilograms. After inputting, the inputt
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!