CIS3931 Intro to JAVA Programming
Assignment #7 – A JAVA Web Browser
Note : This assignment
is voluntary. It is meant to take the place of one of your previous program
grades. This program will not count against you if you do worse than you did on
your other programs. Assignment 7 will only be used for a grade if it is higher
than one of your other programming grades.
Overview
For this assignment you will be create a simple calculator in JAVA.
Details
The GUI interface for your calculator should look *exactly* like the following example :
The title of the JFrame should be “Simple GUI Calculator” .
You will need to make JButtons for the numbers 0 through 9, add, multiply, subtract, divide, equals, and clear.
Your JButtons should be contained in a Panel. The layout of your panel is very important so that the buttons line up and are spaced correctly. This will be discussed in the lecture notes.
The Panel should be added to a JToolBar which is then placed at a BorderLayout.CENTER position.
Below the JToolBar will be a JTextField. This should be placed at the bottom using a BorderLayout.SOUTH position.
Examples of positioning items using a BorderLayout can be found in the example programs.
The calculator will be very simple in function. It will only do single-operation arithmetic which is calculated once the equals button is pressed. You should have to press the clear (“C” button) after every arithmetic operation in order to properly clear the display and start an new arithmetic operation. If you press an operator instead of clear, your program should use the existing number for the operation.
The program should handle decimal outputs. This means that 100 / 8 should produce 12.5 as the answer. Additionally, the program should not output unnecessary decimals places. This means that 100 / 25 should produce 4 (not 4.0) as the output.
The program will be demonstrated in class. Your program is expected to behave exactly as demonstrated in class.
Actual Program Output
The following is a list of
button presses and the corresponding display in the JTextField.
Your program should produce the exact same output if you were to perform the
following sequence of entries.
Sequence Number |
Entry |
Actual Display in the JTextField |
1 |
81 |
81 |
2 |
/ |
[clear] |
3 |
3 |
3 |
4 |
= |
27 |
5 |
C |
[clear] |
6 |
3 |
3 |
7 |
+ |
[clear] |
8 |
27 |
27 |
9 |
= |
30 |
10 |
+ |
[clear] |
11 |
10 |
10 |
12 |
= |
40 |
13 |
/ |
8 |
14 |
= |
5 |
15 |
* |
[clear] |
16 |
20 |
20 |
17 |
= |
100 |
18 |
/ |
[clear] |
19 |
8 |
8 |
20 |
= |
12.5 |
Grading
5 points – Name, date, and assignment number on top of program
15 points – Proper commenting
10 Points – Programming style
20
Points – GUI is constructed correctly and looks like the example in the program
description
50 Points – Program produces correct output
Total : 100 points
Program due date and submission instructions
This
program is due no later than Thursday, 4th August, 2005 at 11:59:59
pm.
THERE IS NOT GRACE PERIOD ON THIS PROGRAM!!!! The
absolute due date of this program is the 4th of August.
Any program submitted after the 4th of July will not be graded!! No late programs will be accepted.
The program should be named Assignment7YOURFULLNAME.java
(Example : Assignment7RobertThornton.java)
You are to submit your source code (your .java file) to cis3931 at cs dot fsu dot edu
For
assignment clarifications, please e-mail
For help with your program, please e-mail cis3931 at cs dot fsu dot edu