Computer Science, asked by Harini4045B, 8 months ago

any one who knows Java very well... explain me I am a beginner... explain me something about that coding please...

Answers

Answered by shaanullah
1

Answer:

Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. ... Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture.

Explanation:

Java coding

oots of a Quadratic Equation

public class Quadratic {

public static void main(String[] args) {

double a = 2.3, b = 4, c = 5.6; double root1, root2; double determinant = b * b - 4 * a * c; // condition for real and different roots if(determinant > 0) { root1 = (-b + Math.sqrt(determinant)) / (2 * a); root2 = (-b - Math.sqrt(determinant)) / (2 * a); System.out.format("root1 = %.2f and root2 = %.2f", root1 , root2); } // Condition for real and equal roots else if(determinant == 0) { root1 = root2 = -b / (2 * a); System.out.format("root1 = root2 = %.2f;", root1); } // If roots are not real else { double realPart = -b / (2 *a); double imaginaryPart = Math.sqrt(-determinant) / (2 * a); System.out.format("root1 = %.2f+%.2fi and root2 = %.2f-%.2fi", realPart, imaginaryPart, realPart, imaginaryPart); } } }

Similar questions