subject
Engineering, 07.12.2019 05:31 shiny9362

This program is meant to use a gui to actually control our memory calculator. to do this, you will need to create an instance of memorycalc in the calcgui and write event handlers to pass information back and forth between the calculator and the gui. there are many possible ways to achieve this, but the easiest is probably to develop four different event handlers:
digithandler - this event handler is added to the 0-9 and . (dot) keys. if the equals button was just pressed, this event handler will overwrite the total shown in the text field with the value of the key (its label) that was just pressed. if the equals button was not just pressed, this event handler will append the current key's label onto the end of the string shown in the text field.

operatorhandler –this event handler is added to the +, -, *, and / keys. it sets the value of a class field to the operator that the user has chosen.

clearhandler – this event handler is added to the c key. it calls the calculator's clear method and sets the value of the text field back to 0.0.

equalshandler – this event handler is added to the = key. it reads the current value from the text field, converts it to a double, and calls the appropriate calculator method based on the current operator, passing in the double value. the calculator will compute the answer, and then this event handler will update the value in the text field to the calculator's current total.

that is all that required for the homework assignment, however i also encourage you to play around with the different types of calculators we have written in this course, perhaps after this course ends. for instance, you could add functionality for geometric operations like sine and cosine. or you could create a super calculator that has different views for scalar, vector, and matrix calculations. whatever you come up with, i suggest you clean it up and document it. potential employers always look favorably on being able to review code you have written and ask you questions about it.

hints:
you can use the action event's getsource() method to get a reference to the button that was pressed, and you can use button's gettext() method to find out the label of that button.

when the equalshandler is converting the text shown in the text field into a double value in order to pass it to the calculator, be careful to handle the case where the text field contains an invalid value, such as 6..72. in this case you should catch the exception, display an error message to the user, and abort the call to the calculator (just restore the current total to the text field).

the user should only be able to enter numbers between when an operator has been selected and when the equals button has been pushed. the digithandler should ignore any button presses when the gui is not in this state.
you will be graded according to the following rubric:
? something happens when the user clicks on any of the keys of the calculator javafx gui
? the user cannot enter a value without first choosing an operator.
? the user is able to enter numbers correctly (i. e. the previous total is overwritten when the user starts a new number, and new digits are appended to the new number).
? when the equals button is pressed, the appropriate calculator method is called based on the operator the user has selected.
? when the equals button is pressed, the appropriate operand passed to the calculator method as an argument.
? when the equals button is pressed, the value in the text fieldis updated to the new total:
? the clear button calls the calculator's clear method and updates the text field to 0.0.

ansver
Answers: 1

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Ajournal bearing has a journal diameter of 3.250 in with a unilateral tolerance of 20.003 in. the bushing bore has a diameter of 3.256 in and a unilateral tolerance of 0.004 in. the bushing is 2.8 in long and supports a 700-lbf load. the journal speed is 900 rev/min. find the minimum oil film thickness and the maximum film pressure for both sae 20 and sae 20w-30 lubricants, for the tightest assembly if the operating film temperature is 160°f. a computer code is appropriate for solving this problem.
Answers: 3
question
Engineering, 04.07.2019 18:10
Atmospheric air has a temperature (dry bulb) of 80° f and a wet bulb temperature of 60° f when the barometric pressure is 14.696 psia. determine the specific humidity, grains/lb dry air. a. 11.4 c. 55.8 d. 22.5 b. 44.1
Answers: 1
question
Engineering, 04.07.2019 18:20
The characteristic roots of a dynamic system are: 1.7920 1.8160 i, -1.7920 1.8160 i, -0.4160 what is the order of this system? what are the settling time and damping ratio of the system?
Answers: 3
question
Engineering, 04.07.2019 18:20
Air flows over a heated plate àt a velocity of 50m/s. the local skin factor coefficient at a point on a plate is 0.004. estimate the local heat transfer coefficient at this point.the following property data for air are given: density = 0.88kg/m3 , viscosity 2.286 x 10 ^-5 kgm/s , k = 0.035w/mk ,cp = 1.001kj/kgk. use colburn reynolds analogy.
Answers: 1
You know the right answer?
This program is meant to use a gui to actually control our memory calculator. to do this, you will n...
Questions
question
Mathematics, 05.04.2021 20:10
question
Computers and Technology, 05.04.2021 20:10
question
Mathematics, 05.04.2021 20:10
question
Mathematics, 05.04.2021 20:10
question
Mathematics, 05.04.2021 20:10
question
World Languages, 05.04.2021 20:10
question
English, 05.04.2021 20:10
question
Mathematics, 05.04.2021 20:10
Questions on the website: 13722367