Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVAFX Eclipse please and thank you: Tasks This assignment has two parts: 1. Create a window and add the required GUI elements to it. 2.

JAVAFX Eclipse please and thank you:

Tasks

This assignment has two parts:

1. Create a window and add the required GUI elements to it.

2. Make an event handler for all the GUI elements that require them.

Task 1 Build the GUIs Using the knowledge acquired in the labs, construct a GUI window with buttons for the numbers zero (0) through nine (9), and buttons for addition (+), subtraction (-), multiplication (*), division (/) and finally equality (=). Also add a label/text object that will show the numbers concatenated as the corresponding buttons are pressed. This will be explained more in the following section.

Task 2 Make the Event Handlers The buttons will need event handlers for when they are clicked. When a button is clicked it should concatenate its number or operator to the current calculation. For example, it should show the value 98 if the buttons 9 and 8 were clicked. However, if an operator button was clicked between two numbers then it should show that operator between the values. So it would show 9 / 8 if the buttons 9, then /, and then 8 were clicked. It is important to note that if we click 9, then 8, then /, and finally 8 we would get 98 / 8.

The equal (=) button is special in that if it is clicked after a viable operation occurs it should replace the whole equation with the result of the calculation. Therefore, we should never see the = in the label. For instance, 98 / 8 evaluates to 12.25, so the label should show 12.25 after the equal sign button is clicked. NOTE: Assume that the equal sign is only pressed after at least two separate numbers and an operator are entered and that the user will want to use that as their first number for the next operation. That means if a new number is pressed, then it will be added to the end (as the last digit) of the result from the last operation. Also, this should work for at least two (2) digits, but your calculations do not need to work for more than that. Below is some possible sample output (note: simply means, there exists): The last button pressed has a dark blue highlight around the edges.

Sample outputs:

image text in transcribed

image text in transcribed

Form1 - 0 x 0110 N Form1 - 0 X Form1 - OX 101 Form1 - 0 x 0110 N Form1 - 0 X Form1 - OX 101

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions