Your question:
How to combine the GUI class and the scanner class?
Short answer: don't.
Longer answer: At least don't try to combine a GUI with a Scanner tied to System.in/console as that leads to the attempt to mesh two diametrically opposed ways of getting user input: linear console input vs event-driven GUI interaction. Instead, why not let users enter information via the GUI in an event-driven manner? Else you lose all the advantages of using a GUI in the first place and risk tying up your GUI's event thread for console input.
In your case, I'd have three JTextFields or JFormattedTextFields or JSpinners that the user can enter in data, and then I'd display the results in another text component or JLabel, after a JButton has been pressed and its Action initiated.
Other problems: your GUI is a JApplet, and yet you've given it a main method and run its main method which is never going to work and won't display the GUI. Please read the GUI tutorials which you can find here. Instead display a JFrame, not an applet, override a JPanel and draw in its paintComponent method (as per the tutorials), and again get rid of all the Scanner code.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…