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
What is the duty of WHH? (white hat hackers)<br><br><br>ANY WHH HERE?<br>​
Minchanka [31]
White hat hackers use their capabilities to uncover security failings to help safeguard organizations from dangerous hackers. They can sometimes be paid employees or contractors working for companies as security specialists who attempt to find gaps in security.
6 0
2 years ago
The automated key distribution approach provides the flexibility and dynamic characteristics needed to allow a number of users t
docker41 [41]

Answer:

The correct answer is option A. "True".

Explanation:

Key management could either be manual or automated. The automated key distribution approach is more flexible and dynamic than the manual key distribution approach, because it is better at responding to changing requirements in the system. Additionally, the automated key distribution approach is faster and more economic as well as observable and auditable.

6 0
3 years ago
In computer science, what is the name for a series of steps used to solve a problem?
liraira [26]

Answer:

Algorithm

Explanation:

It is the step by step procedure,which defines a set of instructions which is to be carried out by the computer

5 0
3 years ago
the mail merge feature can be used to address the same letter to several different people , true or false
sergij07 [2.7K]
The answer is that it is true.
4 0
3 years ago
Read 2 more answers
4
Nataly_w [17]

Answer:

5 hours 25 minutes

Explanation:

It takes 25 minutes to finish a hole

It takes 25*13 minutes to finish 13 holes

325 minutes is require to finish 13 holes

Convert 325 minutes to hours and minutes by dividing it by 60

=5 5/12 hours

Convert 5/12 hours to minutes by multiplying by 60

=25 minutes

The answer is 5 hours 25 minutes

5 0
3 years ago
Other questions:
  • Below is a chart representing portions of resumes from 3 applicants. Which best explains the applicants careers?
    11·1 answer
  • Que funcion tiene la sombrilla forrada de aluminio​
    6·1 answer
  • What is the command to create a compressed archive(archive1.tar.gz) of files test1 test2and test3.
    5·1 answer
  • Where could an identity thief access your personal information?
    13·1 answer
  • My name Jeff <br><br> what movie is this off of
    6·2 answers
  • Mad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (a
    14·1 answer
  • For C++ ONLY please,
    14·1 answer
  • 50 POINTS How do you express yourself and your creativity through computer science?
    12·1 answer
  • Can someone find out what this binary number thing is. Just find out the message, I'm having a difficult time
    13·1 answer
  • Which of the following database object hold data?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!