Please help with what I have.Code and outcome picture below. ///////////////////
ID: 3818123 • Letter: P
Question
Please help with what I have.Code and outcome picture below.
//////////////////////////////////////////////////////////////////////////////////////////////////
Write a binary calculator with a GUI interface similar to that shown in the attached screen shot. Use BoxLayout or GridBagLayout. All values are displayed in binary. See Integer.parseInt() and Integer.toString().
The calculator has four registers: X, Y, S, and T. It also has nine control buttons that behave as follows:
Clear - the contents of the X register is replaced with the single character "0", and the firstEntry flag is set
1 - if firstEntry, a "1" replaces the X register contents and the flag is cleared, else the X register contents with a right-appended "1" replaces the X register contents
0 - if firstEntry, a "0" replaces the X register contents and the flag is cleared, else the X register contents with a right-appended "0" replaces the X register contents
Enter - the registers roll-up, and the firstEntry flag is set
x+y - the sum of the X and Y registers replaces the X register and the registers roll-down; the firstEntry flag is set
x-y - the Y register is subtracted from the X register, the result replaces the X register, and the registers roll-down; the firstEntry flag is set
x*y - the product of the X and Y registers replaces the X register and the registers roll-down; the firstEntry flag is set
x/y - the Y register is divided into the X register, the integer result replaces the X register, and the registers roll-down; the firstEntry flag is set
Swap - the contents of the X and Y registers are exchanged
Register Roll-up
the T register goes off-screen, the S register replaces the T register, the Y register replaces the S register, the X register replaces the Y register; the X register is unchanged
Register Roll-down
the S register replaces the Y register, the T register replaces the S register, the T register is set from off-screen
Off-screen
An array list of Strings is used the save values that go off-screen from the T register. Values are added to the end and removed from the end of the array list.
Clear Calculator 1 o T Swap 0 S x y 0 Y 0 X Enter