Write the buttonhandler inner class

Assignment Help JAVA Programming
Reference no: EM13704516

Question: Assume the existence of the subsequent 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.

Ensure 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.

The solution must be error free and compile correctly on first attempt.  Any code that does not do this will not be awarded points. Do not copy other same questions. I need real help and will rate for that

Reference no: EM13704516

Questions Cloud

Calculates the cutoff frequency in a simple rc circuit : Write a simple Java application which calculates the cutoff frequency in a simple RC circuit.
Provide a regular expression that shows the set of strings : Provide a regular expression that shows the set of strings over {a, b} thatcontain at least one b if its length is at least four.
Calculates the cutoff frequency in a simple rc circuit : Write a simple Java application which calculates the cutoff frequency in a simple RC circuit. Your application should ask the user to enter the capacitor and resistor values of the circuit. You must use the JOptionPane class to collect the user's ..
Write a method shift that takes a stack of integers : Write a method shift that takes a stack of integers and an integer n as parameters and that shifts n values from the bottom of the stack to the top of the stack.
Write the buttonhandler inner class : 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 upda..
Explain in words a linear-time algorithm : The max subsequence product problem for an array a = a1,a2,...,an of integers is the problem of determining the largest product E(summation)k=1(bottom) j(top) ak formed by a subsequence of a.
Use counting sort to sort an array : State the difficulty in attempting to use counting sort to sort an array of n floating-point numbers from the continuous interval [0,1].
Distributed file system : What problems/issues are involved with a distributed file system (DFS) with regards to data consistency?
Write a function which takes two string variables : Write a function which takes two string variables not C strings as inputs and compares them. If they are equal, the function should return 0. If the first-string is less than the second string, return a negative number. If the first string is grea..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Method called printpowersof2 that accepts a maximum number

Write a method called printPowersOf2 that accepts a maximum number as an argument and prints each power of 2 from 20 (1) up to that maximum power, inclusive. For example, consider the following calls: printPowersOf2(3); printPowersOf2(10)

  Write methods in java

1. int countVowels (String s) That for a given string s, return number of vowels in s.

  Wrappershallow and wrapperdeep

Each class is simply a wrapper class to hold a private array variable. int [] a; The default constructor for each class should initialize â??aâ??. Each class should have a toString() and equals(). Each class should have a setArray method that allows ..

  Java application to declare and create a vector

Write a java application that perform the following task: declare and create a vector with initial size of 10, increment of 2

  Program that simulates the rolling of a single die1000 times

Write a program that simulates the rolling of a single die 1000 times. The program must use an array of size 6 and not 1000 to store the occurrences of each side or face on the six-sided die. The program should output the particular die face and the ..

  Implement a recursive method that evaluates the gcd

Implement a recursive method that evaluates the GCD of the given numbers - Use the above fact to create a recursive method in Java that computes and returns the gcd of two positive integers. Comment the code.

  Implement 4 sorting algorithms in a java "sort" class.

Implement 4 sorting algorithms in a Java " Sort " class. ( insertion sort, selection sort and quicksort, and mergesort). count the number of comparisons made.

  Method that receives an array and returns with no duplicate

Write a program that contrains a method that receives an array and returns a new array with no duplicates.

  Add a button that will read the text fields

Create a GUI with two text fields for inputting the dimensions of a rectangle. Identify these two text fields as Length and Width with labels. Add a button that will read the text fields and cause the GUI to display the area and perimeter of the r..

  The array at the index method

have an array, how do i remove an entry from the array at the index method?

  Movie should be represented

Each movie should be represented by an object of type Movie. The Movie class must provide two public fields: title and category. Both of these fields should be Strings. The class should also provide a

  The sixth amendment allows the due process right to council

The Sixth Amendment allows the due process right to council. Several Supreme Court cases have clarified this right for those who cannot afford their own attorneys. Discuss the right to an attorney for indigent defendants. What are the three main syst..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd