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
Agata [3.3K]
4 years ago
9

Write the program to solve quadratic equations, but if the discriminant is negative, output

Computers and Technology
1 answer:
Firdavs [7]4 years ago
8 0

Answer:

PROGRAM  QuadraticEquation Solver

  IMPLICIT  NONE

REAL :: a, b, c ;

  REA :: d ;

  REAL  :: root1, root2 ;

//read in the coefficients a, b and c

  READ(*,*)    a, b, c  

  WRITE(*,*)   'a = ', a

  WRITE(*,*)   'b = ', b

  WRITE(*,*)    'c = ', c

  WRITE(*,*)

// computing the square root of discriminant d

  d = b*b - 4.0*a*c

  IF (d >= 0.0) THEN              //checking if it is solvable?

     d     = SQRT(d)

     root1 = (-b + d)/(2.0*a)     // first root

     root2 = (-b - d)/(2.0*a)     // second root

     WRITE(*,*)  'Roots are ', root1, ' and ', root2

  ELSE                            //complex roots

     WRITE(*,*)  'There is no real roots!'

     WRITE(*,*)  'Discriminant = ', d

  END IF

END PROGRAM  QuadraticEquationSolver

You might be interested in
What it the total resistance in a series circuit with two resistors of 100 ohms each?
snow_tiger [21]

Answer:

200Ω

Explanation:

In series circuits, you add the resistances.

3 0
2 years ago
Define a method printAll() for class PetData that prints output as follows with inputs "Fluffy", 5, and 4444. Hint: Make use of
QveST [7]

Answer:

public void printAll(){  // member function petAll()

   super.printAll();  //  calls printAll() method of the superclass (base class) AnimalData using super keyword

   System.out.print(", ID: " + idNum);} // prints the ID stored in the idNum data member of the PetData class

Explanation:

Here is the complete PetData class:

public class PetData extends AnimalData {  //

private int idNum;

public void setID(int petID) {

idNum = petID;  }

// FIXME: Add printAll() member function

/* Your solution goes here */

public void printAll(){

   super.printAll();

   System.out.print(", ID: " + idNum);}  }

PetData class is a subclass which is inherited from the base class AnimalData.

This class has a private data member which is the variable idNum which is used to store the ID value.

It has a member function setID with parameter petID which is the idNum. This method basically acts as a mutator and sets the user ID.

This class has another method printAll() that uses super keyword to access the method printAll() of the base class which is AnimalData

super basically refers to the base class objects.

Here the super keyword is used with the method name of subclass PetData in order to eliminate the confusion between the method printAll() of AnimalData and PetData since both have the same method name.

In the main() method the use is prompted to enter values for userName, UserAge and UserID. Lets say user enters Fluffy as user name, 5 as user age and 4444 as userID. Then the statement userPet.printAll(); calls printAll() method of PetData class as userPet is the object of PetData class.

When this method is called, this method calls printAll() of AnimalData class which prints the Name and Age and printAll() of PetData class prints the ID. Hence the program gives the following output:

Name: Fluffy, Age: 5, ID: 4444    

8 0
3 years ago
Which of the following is a best practice regarding the Administrator account?
lara31 [8.8K]

Answer:

B. The account should be given a nondescript account name that cannot be easily guessed.

3 0
3 years ago
What rule should be followed when determining how many bullets you will include on a slide
stiks02 [169]
They answer to your problem is C
8 0
3 years ago
Read 2 more answers
Dr. Wisteria is a prominent chiropractor in the Chicago area. She wants to provide a forum for her patients to discuss their hea
Svet_ta [14]

The best-suited telecommunications tool for Dr. Wisteria is a blog.

a blog

<u>Explanation:</u>

A blog can be defined as an informational website and more a platform for exchanging views and ideas about a particular topic.

There are various blogging platforms available. Dr. Wisteria should start writing blogs about health issues and in this way, she would be able to interact with all the people accessing the blog. People can also post their queries about their health issues and Dr. Wisteria can always reply to them.

This would also create a lot of awareness about any particular health issue being discussed as it is not necessary that only those people who want to post something will access the blog post, it can always be accessed by anyone.

5 0
3 years ago
Read 2 more answers
Other questions:
  • Determine encryption that is needed to provide security for the company’s system. This will include plans to address: Passive an
    11·1 answer
  • In Linux, when logged in as a normal user with root privileges, which command must precede the apt-get command in the command li
    13·1 answer
  • What are motion graphics?
    9·1 answer
  • Which one is not an operating system?1.mac 2.Microsoft office3.Iso.3.Android
    11·1 answer
  • When are bar charts most commonly used
    10·1 answer
  • write a program to update the rate by increasing 20% from sequential data file "items.dat" that store item name.rate and quantit
    15·1 answer
  • You have many drugs that you want to store electronically along with their purchase dates and prices, what kind of software woul
    7·1 answer
  • JUST NEED TO KNOW WHO ALL DOSE EDGINUITY
    12·2 answers
  • Which of the following is the best description of the [Drive for] block?
    15·1 answer
  • Choose the output result of the below code.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!