Course web page: Introduction to Computer Science for non-majors II James Tam Return to the course web page

Due Tuesday March 31

New Concepts to be applied for the assignment

Description

Create a simple calculator that will multiply two numbers. When the program first starts it will display a container and a button 'multiply' (Figure 1). You can configure the layout however you wish but it must show all the required controls and it must also be presented in a way that is easy to understand/interpret (no garbled messages or messed up display of GUI components).

Figure 1: Main window

When the user clicks on the button prompts will appear in the console command line for the two numbers to be multiplied (Figure 2). If the user clicks on the close window control then the program will end (the window will not just disappear).

Figure 2: prompts are text-based

The resulting product will appear back in the GUI in the form of label (Figure 3).

Figure 3: The result is displayed using a graphical label

Note that the mixing of console input and graphical output is not the usual approach taken in actual software. This approach was chosen to determine if students truly understand the event model well enough to apply the concepts in a way that is almost certainly different from both the examples provided in class and anything that may be found online or elsewhere (no "ready to download" solutions). This means that deviations in the assignment specifications will result in lesser credit (or perhaps no credit) being awarded.

Features/marks (Max 15)

Note: in order to receive credit the correct graphical controls must be used (e.g., a 'JDialog' could not be used in place of a 'JFrame')

Marking key

Marks earned 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Grade point 4.0 3.7 3.5 3.3 3.1 2.9 2.7 2.5 2.3 2.1 1.9 1.7 1.5 1.3 1.0 0.0

Submitting your work:

  1. Assignments (source code/'dot-java' files and the class diagram) must be electronically submitted according to [the assignment submission requirements] using [D2L]. Since you can submit multiple times in D2L it may be very confusing for your TA if you submit things piecemeal via multiple submissions i.e., the marker may mark your work with the wrong version of a file if he or she doesn't note latest submission date. Consequently each time that you submit your work you should submit every relevant file (it may make it easier if you bundle them all using the 'zip' compression utility before you upload them to D2L0.
  2. As a reminder, you are not allowed to work in groups for this class. Copying the work of another student will be regarded as academic misconduct (cheating).  For additional details about what is and is not okay for this class please refer to the following [link].

External libraries that can be used

  1. You  can use the appropriate GUI Component child classes (such as JButton) as well the the appropriate event handler.