Homework 1 - Simple Calculator (Due 1/22)
Part 1
Create an HTML file with the interface for a calculator.
- Call the file <AndrewID>_hw1.html
- Create/edit it in a text editor
- Make the HTML file display an interface to a four function calculator. Include the following components:
- A text input labelled "X"
- A text input labelled "Y"
- A button labelled "+"
- A button labelled "-"
- A button labelled "*"
- A button labelled "/"
- A locked (write-protected) textbox labelled "Answer"
- All design/presentation aspects of the interface must be done using CSS, either as an embedded style="..." or as
a div id="..." and corresponding rule where appropriate
- All CSS rules should be contained within the html file such that only one
file is submitted during handin
- Your interface should look better than what was shown in lecture:
Part 2
- The functionality for the calculator must be implemented in Javascript
- Function and variable names should be reasonable, but are created at your discretion
- All Javascript must be embedded within the html file such that only one file is submitted during handin
- Error messages should be reported for the following inputs
- Divide by zero
- Input is not a number (NaN)
Handin
- Please submit this file via the Digital Drop Box on Blackboard