About 346,000 results
Open links in new tab
  1. Create a java program to solve quadratic equations

    Jun 3, 2013 · Solving a quadratic equation. I have the following written down so far. I am not sure on how to introduce the second method. return -b/(2*a); int root1, root2; root1 = (-b + Math.sqrt(Math.pow(b, 2) - 4*a*c)) / (2*a); root2 = (-b - Math.sqrt(Math.pow(b, 2) - 4*a*c)) / (2*a); return Math.max(root1, root2); . Why return the max of the roots?

  2. Java Program to Solve Quadratic Equation - Tpoint Tech

    Mar 27, 2025 · In this section, first will discuss the quadratic equation after that we will create Java programs to solve the quadratic equation by using different approaches. In the equation ax 2 +bx+c=0, a, b, and c are unknown values and a cannot be 0. x is an unknown variable.

  3. Java Program to Find the Roots of Quadratic Equation

    Mar 20, 2024 · Code to find roots of a quadratic equation: Time Complexity: O (log (D)), where D is the discriminant of the given quadratic equation.

  4. Solve the Quadratic Equation with Java. - Code-Nerd

    Aug 29, 2018 · One of my assigned problems asked me to create a Java program that takes in three inputs (a, b, c), enters them into the quadratic equation ((-b+/-sqrt(b^2-4ac))/(2a)), the outputs the roots. This project assumes you are familiar enough with NetBeans or your IDE of choice that you can set up a java project and run it.

  5. Solving the Quadratic Equation in Java: A Comprehensive Guide

    In this tutorial, you learned how to solve quadratic equations using Java by implementing a dedicated class for mathematical operations. You obtained the roots using the quadratic formula and tested the implementation with a sample equation.

  6. Program to implement a Quadratic equation in Java

    Nov 3, 2018 · In this program, you will learn to find all roots of a quadratic equation in Java. Also, you can use the Java compiler to compile a program.

  7. Languages/Java/math/Quadratic_Equation.java at master - GitHub

    Problem: Solving Quadratic equations in Java- A program that prints all real solutions to quadratic equation ax^2+bx+c=0, if discriminant is negative displays a message "roots are imaginary". import java.util.*;

  8. Java Program for Quadratic Equation (Find Roots With 3 Ways)

    Understand quadratic equations in Java with 3 methods to find roots. Learn Java programs for solving quadratic equations efficiently in this tutorial. Get Started!

  9. Quadratic Equation Program in Java

    In this post, we will develop a Java program for the quadratic equation. It will find the roots of the given quadratic equation. A quadratic equation is an equation of the second degree, meaning it contains at least one term that is squared.

  10. Quadratic.java · GitHub

    public class Quadratic {private double x,y,z; public Quadratic(double a, double b, double c) {x = a; y = b; z = c;} public int noOfRoots() {int returner = 0; double test = (Math.pow(y, 2) - (4*x*z)); if(test > 0) returner = 2; else if(test == 0) returner = 1; else: returner = …

  11. Some results have been removed
Refresh