195k views
2 votes
(Simple computation) The formula for computing the discriminant of a quadratic equation ax^2 + bx + c = 0 is b^2 – 4ac. Write a program that computes the discriminant for the equation 3x^2 + 4x + 5 = 0. Class Name: Exercise01_01Extra

2 Answers

2 votes

bjj is a transformation of f and the significance of those places in your neighbourhood which are named after famous personalities and prepare a chart or table on

User Tashen Jazbi
by
7.2k points
3 votes

The program that computes the discriminant for the equation
3x^2 + 4x + 5 = 0 is:

Class Name: Exercise01_01Extra

public class Exercise01_01Extra {

public static void main(String[] args) {

System.out.println(4 4 - 4 3 * 5);

}

}

It can also be done with:

Python

class Exercise01_01Extra:

def discriminant(self, a, b, c):

"""

Calculates the discriminant of a quadratic equation ax^2 + bx + c = 0

"""

discriminant = b ** 2 - 4 * a * c

return discriminant

if __name__ == "__main__":

# Create an instance of the class

exercise = Exercise01_01Extra()

# Assign coefficients of the quadratic equation

a = 3

b = 4

c = 5

# Calculate the discriminant

discriminant = exercise.discriminant(a, b, c)

# Print the discriminant

print("The discriminant is:", discriminant)

User ShemTov
by
6.9k points