Question: Please do it by Subroutine- Method: You will create a project named QuadMethods with the class name QuadMethods 1.Your program will begin
Please do it by Subroutine- Method:
You will create a project named "QuadMethods" with the class name "QuadMethods
1.Your program will begin (after ID yourself) by inputting the three coefficients of the quadratic.
Use JOptionPane.showInputDialog to input coefficients (a, b, and c)
( see assignment # 5 for an example and the InClass Exercise 3)
Test for a, b ,c, all = 0 and tell the user to input again so that a ,b ,a are not all =0
Test for only a=0 and find the one root and output it.
2. Your program will then calculate the determinate = (b*b-4*a*c) .
3. Based on the determinate your program will then handle the three cases by calling a different method (AKA subroutine) for each of the three cases: determinate = (+, -, 0)
a) For a positive OR 0 determinate use a double array to
b) For a negative determinate you will have real and imaginary parts to
For example for: a=1. b=4, c=5; (negative determinate)
Calculate the real and imaginary parts, and then just concatenate the letter "i" to the end of the imaginary part for the output.
4) Print our the results to the console (including: the input a, b, c; the determinate, and the roots)
Run your program for (at least) the three cases (+), (-) and (0) determinate .
All output to the condole will have two decimal place accuracy
Summary: Your program will start out with these comments
//Users inputs (a,b,c,) will use JOptionPane.showInputDialog to input
// Coefficients a,b,c, must be non zero integers,
// There are three cases for the determinate < determinate > =(b**b -4ac) ; they are (+, 0, -)
// For each of which there be a separate Method
// < determinate > is (0) Two identical roots
// < determinate > is (+) Two Non-identical roots
// < determinate > is (-) Two real roots plus Two imaginary roots (i)
// The roots will be passed
// All output of input and of results will be from main to the console;
// At a minimum test the classes for a ,b, c, of
// 1,4,5 and 1,2,1, and 1,4,1 to get (-, 0 , +) cases
// Do not use any advance methods not covered so fare,
// Calculate the determinate, and the roots using simple algebra.
//
// QuadMethods by your name
// Import what you need for I/O
public class QuadMethods {
public static void main(String[] args) {
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
