Saturday, April 24, 2010

Assignment 14 - Simple Calculator

LABAR Project 14
This assignment is to be done during your one hour lab by arrangement (LABAR). This assignment requires you to write your first javascript to declare, assign and display three variables of the string, number, and boolean types respectively.
In this assignment, Assignment #14, you are to create a simple calculator as in the HTML Form below. This calculator can:
  • provide the add, substract, multiply, divide, and clear javascript functions;
  • provide two HTML text inputs for user to enter the two operaand numbers;
  • provide a HTML text input for the onClick triggered math function to place the result (number);
  • when one of the math operator button, one of the + - * / buttons, is pressed, i.e. onClick event, the corresponding math function shall place the result in the Answer text Input;
  • when the Clear button, the "C" button, is pressed, i.e. onClick event, all text Input fields shall be cleared.

Enter a number:
Enter a number:

Answer =

The above html form code is listed below:


Sample Code:
Javascript Adder

 

Try this adder out!

Simple Adder
Enter a number:
Enter a number:


Answer =

No comments:

Post a Comment

 

comsc-100 Copyright © 2009 Gadget Blog is Designed by Ipietoon Sponsored by Online Business Journal