IFSM247P –
Introduction to PowerBuilder Programming
Project #2 –
Calculator
*** DUE BY 11:30pm 6/18/2000 ***
Project 1 Example Executable (Right mouse click and use Save Link As to copy to your computer)
Learning Objectives: Through this project you will be exposed to the following concepts:
Datatypes and variable scope
Window controls and properties
Event driven programming
Graphical interface design
Error reporting
Compiling source code into a native windows application
Goal/Specifications: The goal of the project is to develop a simple mathematical calculator with the following requirements:
The display of the calculator should handle 8 significant digits. Decimal calculations that would exceed 8 significant digits should be rounded so that only 8 significant digits appear in the display. If a calculation would exceed 8 significant digits, the word Error should appear in the display. (20 pts). There will be a 10 pt deduction if any calculation entered does not round to 8 significant digits.
A function should be created to handle the rounding of all answers, including square root. Rounding must be dynamically calculated, based on the position of the decimal point, not hard coded.(10 pts)
The Clear Entry key must allow the calculation to continue. If I press "99 + 1 * 5 CE", the display should reset to 0, but then I should be able to press "6 =" and get the answer 600 to display in the calculator (10 pts)
I should be able to enter another calculation after pressing the equal sign. I should never have to press Clear to get a calculation to work properly. (10 pts)
The Clear key should clear all variables used for calculations as well as reset the display to 0. (5 pts)
Mathematical calculations should be performed in a single function, attached to either the window or globally to the application. (5 pts)
A clear entry key should be used to re-set the display to the previous display. (5 pts)
The calculator should be able to handle a simple calculation. If I enter 3 * 4, then press the equal button, I should see the answer 12 in the calculator’s display. (5 pts)
The calculator should be able to handle a string of calculations. The user should be able to enter 2 + 3 + 5 / 2, then press the equal button and get the answer 5. (15 pts)
Anytime an attempt
is made to divide by zero, the word Error should appear in the display. The program should not crash (GPF). (5) pts)
The user should be able to enter calculations using their mouse and the
buttons on their calculator. (2 pts)
The normal
mathematical calculations should be available (addition, subtraction,
multiplication, and division) as buttons.
(2 pts)
A Button should be available to
calculate square root. Taking the
square root of a negative number should display the word Error in the display.
(2 pts)
At least two menu options should be available to the user: one to exit the application (File – Exit), another to display your name and ssn (Help – About)(2 pts)
You should only be able to enter one decimal point per number. (2 pts)
Additional Scoring: Programming style: The instructor is looking for good programming form in regards to variable naming, upper and lower case use, and indenting. If your code is easy to read and consistent in format 10 points are awarded, otherwise 0 points. Not commenting your application object with your name and ssn will result in 0 pts, regardless of style.
A project that does not compile will receive no more than 50% of the grade. This is for an incomplete project where a good effort was made. Garbage will receive 0%.
Administrative Stuff: In the Application Open Event of your calculator application, in comments, please include your name and social security number. If there is any explanation that you wish for me to have, please include it in the comments in the Application Open Event.
Everything for this project should be contained in one pbl file.
All projects are to be submitted via email.
Any project submitted after 11:30pm on 4/8/2000 is considered late. You are responsible for providing adequate time for your email to reach me by the due date and time. Late projects will have one letter grade per day deducted from their score.
Scholastic Integrity: Students are expected to maintain a high standard of personal scholastic integrity. Any plagiarism of another student’s work will result in receiving 0 pts on the project. If a student willingly allows another student to copy their work, both parties will receive 0 pts.