Maximum and Minimum value of a quadratic function | Java implementation of the above approach ; Function to print the Maximum and Minimum values of the quadratic function ; Calculate the value of second part ; Print the values ; Open upward parabola function ; Open downward parabola function ; If a = 0 then it is not a quadratic function ; Driver code
import java . util . * ; class GFG { static void PrintMaxMinValue ( double a , double b , double c ) { double secondPart = c * 1.0 - ( b * b / ( 4.0 * a ) ) ; if ( a > 0 ) { System . out . print ( " Maxvalue ▁ = ▁ " + "InfinityNEW_LINE"); System . out . print ( " Minvalue ▁ = ▁ " + secondPart ) ; } else if ( a < 0 ) { System . out . print ( " Maxvalue ▁ = ▁ " + secondPart + "NEW_LINE"); System . out . print ( " Minvalue ▁ = ▁ " + " - Infinity " ) ; } else { System . out . print ( "Not a quadratic functionNEW_LINE"); } } public static void main ( String [ ] args ) { double a = - 1 , b = 3 , c = - 2 ; PrintMaxMinValue ( a , b , c ) ; } }