Answered step by step
Verified Expert Solution
Question
1 Approved Answer
QUESTION 3 [49 MARKS 3.1) Write the Java statements for a class called Calculator to produce the GUI below. Use 3 panels to arrange the
QUESTION 3 [49 MARKS 3.1) Write the Java statements for a class called Calculator to produce the GUI below. Use 3 panels to arrange the components. You must use an array when defining the numbered buttons (o-9. Do not declare 10 buttons individually. The textfield must be initialized with the text as shown below, and be able to accommodate up to 25 characters. The spacing between the numbered buttons is 10. (28) for caloula Add Equals 3.2 Rewrite any existing Java code of the class definition in 3.1 which needs to be changed, as well as any additional event-handling code, to display the appropriate numeric value in the textfield when the user cicks on the numbered buttons. If the user clicks on a combination of numbers then the entire multi-digit number is displayed in the textfield 3.3 Now write further Java statements to do the following Once the user has clicked a digit or combination of digits followed by the Add button then the single or multi-digit number must be stored before the textfield is cleared. The user can then click on more digits to make up a second number followed by the Equals button. Ater clicking on the Equais button the sum of the 2 selected numbersis (10) displayed in the textfield. 3.4 Write the Java statements for a class called RunCalculator, in which you declare a main method with Java statements to display the GUI. The dimensions of the frame are width 300 and height 300. Page 7 of 7
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started