GUI (3) Java

23.00 $

Category:

Description

5/5 - (2 votes)

Assume the existence of the following Java GUI application. There are two text fields for user input. The first JTextField variable is named res and is used to input a resistance value in ohms. The second JTextField variable named cap is used to input a capacitance value in farads. The resistance value in an integer and the capacitance value is a floating point number. The user clicks a JButton to perform a calculation. One JButton called tc causes the program to calculate and display the RC time constant of the RC circuit, tc = R * C. Another JButton called cutoff causes the program to calculate the cutoff frequency of the RC circuit, cutoff = 1 / (2 * pi * R * C). The result of the selected calculation is displayed in an output text area variable named output. The output string should say something like this: “The RC time constant for resistance 1000 and capacitance .000001 is 0.001 seconds.” Clicking one of the buttons generates the event which causes the program to do the selected calculation and update the output area. Assume the user interface has already been implemented and the member variables listed above exist. Your job is to write the ButtonHandler inner class which handles the events from the two buttons, does the requested calculation and displays the appropriate result. Make sure that your capacitance values are output with at least six digits after the decimal point, and your results with four digits after the decimal point.

  • GUI-3.zip