Question: Hello! so this is java language. i am working on gui java program. this program solves quadratic equations. what i have so far works but
Hello! so this is java language. i am working on gui java program. this program solves quadratic equations. what i have so far works but not for imageinary numbers. so i want to add codes which will solve imaginary numbers.
example will be if A=1, B=2, C=3. then solution is with imaginary number(giveing in the screenshot). this is what i have so far and solution for imaginary numbers need to looks like it is in the screenshot. (1+2, 12)
Thanks.
. 
import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.text.DecimalFormat;
class QuadraticFrame extends JFrame
{ private JLabel lblTitle; private JLabel lblFirst; private JLabel lblSecond; private JLabel lblThird; private JTextField txtFirst; private JTextField txtSecond; private JTextField txtThird; private JTextField txtAnswer1; private JTextField txtAnswer2; private JButton btnSolve; private JButton btnClear; private final int WINDOW_WIDTH = 700; private final int WINDOW_HEIGHT = 700; private Font font = new Font("Serif", Font.BOLD, 30);
public QuadraticFrame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle("Find the roots"); buildPanels(); setSize(WINDOW_WIDTH, WINDOW_HEIGHT); setVisible(true); } private void addComponentsAndSetFont() { JComponent components[] = { lblTitle, lblFirst, lblSecond, lblThird, txtFirst, txtSecond, txtThird, txtAnswer1, txtAnswer2, btnSolve, btnClear }; for(int i=0; i } public class QuadraticApp { public static void main (String args[]) { new QuadraticFrame(); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
