Menu

[Solved]Java Intellij Idea 201911 Please List Main Well Mostly Issues Getting Come Together Questi Q37139430

JAVA ONLY (IntelliJ IDEA 2019.1.1) , PLEASE LIST THE MAIN ASWELL, MOSTLY HAVING ISSUES GETTING IT ALL TO COME TOGETHER

Question: Create a GUI for a stack-based calculator,also known as an RPN calculator (Reverse Polish Notati…

create a GUI for a stack-based calculator, also known as an RPNcalculator (Reverse Polish Notation). Make sure that besides aJFrame you also create a JPanel to hold your components, and changethe title of the JFrame to something other than empty. Your programmust have the following:

1) A text field to display the number currently being entered bythe user (can be editable)

2) A text field to display the contents of the stack (must beuneditable)

3) Buttons numbered 0 through 9 for the user to enter theirnumbers

4) Buttons for the mathematical operators for +, -, *, /

5) An Enter button which places the current number on the stackBehind the scenes, you will need a Stack to hold your numbers. Youmay note from the above list that you do not have to support aperiod button for creating decimal numbers, so you could create aStack if you wish (more on this later).

As the user clicks on the numbered buttons, digits are added tothe current number. When they click the Enter button, the currentnumber should be moved to the stack, the contents of the stackfield should be updated, and the current number field should becleared out. Be sure to check for error conditions, such as anempty input field, so you don’t throw exceptions! When the userclicks on a mathematical operator button, you should remove the toptwo numbers from the stack, perform the operation, and place theresult back on the stack. For instance, if the user clicked thefollowing sequence: 6, Enter, 3, Enter, the stack should display[6, 3]. If they then clicked on the minus key, you would remove the3, remove the 6, produce the result of 6 – 3, and push the resultonto the stack, resulting in the stack field displaying: [3]. Thiscan be seen in the screenshots on the last page. Make sure youdon’t get the values backwards for subtraction or division.

When the user presses Enter, and you have to parse the input,you should still check for NumberFormatException errors: they couldhave entered something with too many digits to fit into an integer.Doing all of the above and making it error-free and well commentedwill get you to the 80% mark on grading. For the final 20%,implement two or more of the options below:

1) Allow decimal numbers with a . in them, but don’t allownumbers with more than one period! Use a Stack instead of basing iton integers, and make sure all of your calculations operate ondoubles.

2) Allowing very large numbers by using the BigInteger orBigDecimal classes, located in the java.math package, (look in theindex of the textbook, or at the Java API).

3) Make it so that if there is a number already entered in theinput field which is not on the stack, the user does not have toclick on Enter but can go straight to a mathematical operator,using the input field and ONE number from the stack instead of two.Thus the above example could be more easily done by: 6, Enter, 3,minus. If there is nothing in the input field, use the top twovalues on the stack.

4) Make the input field editable, but only allow the user toenter valid digits (and a period, if desired), by using a keyTypedevent.

5) Allow the user to type numbers not just into the input field,but anywhere in the application. This will be more difficult to do,involving every control having a keyTyped event. You could use thedrag/drop builder to add an event to each item, or add codeyourself after initComponents() is called. Have all events call acommon method that does the work

Expert Answer


Answer to JAVA ONLY (IntelliJ IDEA 2019.1.1) , PLEASE LIST THE MAIN AS WELL, MOSTLY HAVING ISSUES GETTING IT ALL TO COME TOGETHER … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *