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
Coiled springs ought to be very strong and stiff. si3n4 is a strong, stiff material. would you select this material for a spring? explain.
Answers: 2
question
Engineering, 04.07.2019 18:10
Give heat transfer applications for the following, (i) gas turbines (propulsion) ) gas turbines (power generation). (iii) steam turbines. (iv) combined heat and power (chp). (v) automotive engines
Answers: 1
question
Engineering, 04.07.2019 18:10
Apipe with an outside diameter of 15 cm is exposed to an ambient air and surrounding temperature of -20°c. the pipe has an outer surface temperature of 65°c and an emissivity of 0.85. if the rate of heat loss from the pipe surface is 0.95 kw per meter of length, the external convective heat transfer coefficient (h) is: (a) 12.5 w/m"k (b) 18.6 w/mk (c) 23.7 w/mk (d) 27.9 w/mk (e) 33.5 w/mk
Answers: 1
question
Engineering, 04.07.2019 19:20
To design a steam turbine to produce 12,000 hp power. a engineer comsiders using a steady state stean low st 1160fr and engineer considers using a steady state steam flow at 1160°r and 450 psia to drive this steam turbine. the exhaust of the steam is cooled by the lake (vacuum). heat losing to the surroundings is measured at a rate of 555.55 btu/s. (a) sketch the system with the given conditions. (b) neglecting kinetic and potential energy changes from inlet to exit, determine the volumetric flow rate of the steam at the inlet, (ft'/hr). must clearly show unit conversions at crtical terms.
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, 02.06.2021 15:10
question
Mathematics, 02.06.2021 15:10
question
Business, 02.06.2021 15:10
Questions on the website: 13722360