Your task is to develop a standard calculator in Java using BlueJ. Your implementation should use only following three packages: AWT, Swing and Util.Please implement the entire calculator within a single class. The GUI and the internal calculation logics should be separated under different methods. You may also choose to separate different parts of your code using sub-classes. This is what i should look like Please implement a GUI following the exact same layout as depicted in Fig. 1. In particular, the GUI should have the following components. • A display screen. The screen is to display the user inputs and the calculation outputs. The screen will display a digit “0” after the calculator is initialised. • A four-by-four grid with a total of 16 buttons. Among the 16 buttons, 10 of them correspond to the 10 digits, namely, 0, 1, 2, …, 9; four of them correspond to the four basic calculation operators, namely, addition (+), subtraction (-), multiplication (×) and division (÷); one is the equal sign (=), and; one stands for all clear (AC). The display screen will react to any user inputs immediately and display the corresponding information. For example, if the user wants to get the outcome of the following calculation: 102+8×5+69÷3-74=? 15 buttons will need to be clicked for a total of 16 times in the order as specified by Table 1 to complete this calculation and the right answer is 91. The information displayed by the display screen at each time a button is clicked is also given in Table 1. Please note that, the GUI of the calculator needs to follow the exact same layout as given by Fig. 1. However, you can choose the GUI size, button size, font, font style, font size and colour, etc., based on your own preference as long as the calculator is functioning as required. Using other layouts will be penalised
Your task is to develop a standard calculator in Java using BlueJ. Your implementation should use only following three packages: AWT, Swing and Util.Please implement the entire calculator within a single class. The GUI and the internal calculation logics should be separated under different methods. You may also choose to separate different parts of your code using sub-classes. This is what i should look like
Please implement a GUI following the exact same layout as depicted in Fig. 1. In particular, the GUI should have the following components. • A display screen. The screen is to display the user inputs and the calculation outputs. The screen will display a digit “0” after the calculator is initialised. • A four-by-four grid with a total of 16 buttons. Among the 16 buttons, 10 of them correspond to the 10 digits, namely, 0, 1, 2, …, 9; four of them correspond to the four basic calculation operators, namely, addition (+), subtraction (-), multiplication (×) and division (÷); one is the equal sign (=), and; one stands for all clear (AC). The display screen will react to any user inputs immediately and display the corresponding information. For example, if the user wants to get the outcome of the following calculation: 102+8×5+69÷3-74=? 15 buttons will need to be clicked for a total of 16 times in the order as specified by Table 1 to complete this calculation and the right answer is 91.
The information displayed by the display screen at each time a button is clicked is also given in Table 1.
Please note that, the GUI of the calculator needs to follow the exact same layout as given by Fig. 1. However, you can choose the GUI size, button size, font, font style, font size and colour, etc., based on your own preference as long as the calculator is functioning as required. Using other layouts will be penalised.
Step by step
Solved in 3 steps