## Description

The goal of this lab is the creation of a basic but usable graphical user interface. In this case, you

will create a basic calculator using Netbeans. The design of the Calculator GUI is shown in Figure

1.

Figure 1: GUI

Specifications

The first step is the design of the user interface element of the project. After, you will add the

events and the event code to complete the project. In the GUI, all numbers are entered in the

JTextField at the top, as with a standard calculator. To enter a number, you will click the buttons

to build a number in the text field. Then, you select an operation. Then, enter the second number.

Finally, click the =.

Each button will have a specific action, similar to a standard calculator. The specification for each

button is:

• 0 – 9 : Enter the number (single) into the text field

• . : Decimal

• +/- : Toggle the current number from positive to negative

• + : Add operation for the 2 numbers

• – : Subtract operation for the 2 numbers

1

CIT255 Lab5

• / : Real/whole number divide operation for the 2 numbers

• % : Modulus operation for the 2 numbers

• = : Calculate result operation for the 2 numbers

• sqrt : Find the square root of a single number

• File Exit : Exit the application using System.exit(0)

• Help About : Shows your name in the dialog

Submission

Checkoff and submit the file(s) to Blackboard the date and time posted.

2