Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a method called printQuadratic that solves quadratic equations and prints their roots. (Note: Not return, print!) Recall that a quadratic equation is a polynomial

Write a method called printQuadratic that solves quadratic equations and prints their roots. (Note: Not return, print!) Recall that a quadratic equation is a polynomial equation in terms of a, b and c in the form ax^2+bx+c=0a x 2 + b x + c = 0. The formula for solving a quadratic is x=\frac{-b\pm\sqrt{b^2-4ac}}{2a\:}x = b b 2 4 a c 2 a Your method should accept the coefficients a, b, and c as parameters and should print the 2 roots of the equation. For this assignment you may assume that the equation has two real roots, though mathematically this is not always the case. Your main program should then test your method with the following two examples. For LaTeX: x^{2\:}-7x+12x 2 7 x + 12 it should print out LaTeX: x=4,\:x\:=\:3x = 4 , x = 3 For LaTeX: 2x^2+6x\:+\:4\:=\:02 x 2 + 6 x + 4 = 0 it should print out LaTeX: x=-2,\:x\:=\:-1 JAVA PROGRAMMING CS141

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions