JS and Advanced HTML
Midterm Project
Instructions:
Download this program. The program is a simple calculator created with JavaScript. There are 6 total bugs (logic and/or syntax) in the program. You must find each bug and correct it. Each bug fix is worth approximately 11 points (one is worth 10 points). This is NOT an exercise in rewriting code, but in getting the existing code to work. Do NOT create any new functions. When corrected, the calculator should perform in the following manner:
- Upon loading the page, an alert informs the user that they must enter personal info in order to use the calculator.
- A prompt asks for the user first name.
- A prompt asks for the user last name.
- A prompt asks for the user id.
- If the first name or last name is not entered or if the id length is not equal to 4, user is informed via alert and prompted for first name, last name, and id again.
- The users first name is displayed in the appropriate form text box.
- The users last name is displayed in the appropriate form text box.
- The users id is displayed in the appropriate form text box.
- When the user clicks a calculator button, the button value displays in the appropriate form textbox.
- When the user clicks the '=' calculator button, the mathematical expression is calculated and the answer appears in the appropriate form textbox.
- Upon beginning a new mathematical expression, the answer to the old expression is replaced by the new mathematical expression.
NOTE: I strongly recommend learning to use a debugger to assist in determining errors and fixing your code if you are not already familiar with doing so. Internet Explorer has a built-in debugger and here is a video that will help you learn to use it. Firefox has an add-on extension called Firebug which has similar functionality and here is a video that will assist you in installing and using it. Becoming proficient in using a debugger will not only decrease the time you spend debugging code, but will help you attain a deeper understanding of JavaScript and programming in general.
| Midterm Project |
 |