Assignment 3

advertisement
BIT 116: Scripting
Programming Assignment 3
Overview: Modify an existing JavaScript to add functionality to your
Assignment 2 using existing JavaScript APIs.
Based on our discussions in class, choose three different functionality enhancements that
are available as JavaScript Application Programming Interfaces (APIs). Likely places to
look include:
http://www.twinhelix.com/ (by Angus Turnbull)
http://www.walterzorn.com/ (Drag-n-Drop and others)
http://www.quirksmode.org/sitemap.html (see section on DHTML)
For Example:
You might choose to include the Cascading Menu API written by Angus Turnbull to
display appropriate menus in your ATM interface.
ATM: Logout
Transactions: Withdraw, Deposit
Help: About
ATM Login form 
AMT Interface form
1. The Logout, Withdraw and Deposit Menus could duplicate the functionality of the
existing buttons.
2. The About menu could display an alert box with the information: “ATM Interface
Script, copyright 2005, your name”
Carefully read the comments for Angus’ code and experiment with small changes. Ask
questions of your class members and the instructor as needed.
Note that the Cascading menu items are written to accept URL addresses as an argument.
You can include JavaScript within any href in place of the URL by simply beginning the
href with the text javascript: . For example, an HTML link that follows would display an
alert box:
<a href=’javascript: alert(“this is JavaScript within an href”);’> Click me </a>
Submission

The HTML for the revised ATM Login and ATM Interface documents.
Brian Bansenauer © 2001
page: 1
BIT 116: Scripting
Submission
Programming Assignment 3 Submission
Name:
Please print your name and section. Write any comments in the box below.
Evaluation Scale:
0 – Absent
1 – Developing
Program Documentation and Test Criteria

Program comments adequately
document both HTML and JS files.

Additional functionality is clearly
documented with reference to the API
author.

The files execute without syntax errors.
Program Implementation Criteria

Additional functionality works as
intended.

APIs are added as external javascript
files.

Additional functionality is cleanly
integrated into the existing interface.
2 – Adequate
TOTAL SCORE: 0/18
3 – Well Developed
suggestions
suggestions
Student Comments
Brian Bansenauer © 2001
page: 2
BIT 116: Scripting
TestAccount.html file for Assignment 3
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test Account Object</title>
<script language="JavaScript1.2" type="text/javascript"
src="Accounts.js" ></script>
<script language="JavaScript1.2" type="text/javascript"
src="Customer.js" ></script>
<script language="JavaScript1.2">
/*
BIT 116: Scripting Assignment
Brian Bansenauer, copyright 2001
Cascadia Community College
Educational use permitted as long as this header remains -->
Assignment 3: Testing the Customer and Account Objects with methods
*/
var Ian = new Customer( "Ian", "0000", 10, 200, 5);
</script>
</head>
<body>
<h1>Testing the Customer and Account objects</h1>
<h2>Test Account type and getBalance method</h2>
<script language="JavaScript1.2">
document.write(Ian.checking.type);
document.write(Ian.checking.getBalance());
document.write("<p>");
document.write(Ian.savings.type);
document.write(Ian.savings.getBalance());
document.write("<p>");
document.write(Ian.ecard.type);
document.write(Ian.ecard.getBalance());
</script>
<h2>Test the active Account </h2>
<script language="JavaScript1.2">
Ian.active = Ian.ecard;
document.write(Ian.active.type);
document.write(Ian.active.getBalance());
</script>
<h2>Test deposit method: deposit $500</h2>
<script language="JavaScript1.2">
Ian.active.deposit(500);
document.write(Ian.active.getBalance());
</script>
<h2>Test withdraw method: withdraw $100</h2>
<script language="JavaScript1.2">
Ian.active.withdraw(100);
document.write(Ian.active.getBalance());
</script>
</body>
</html>
Brian Bansenauer © 2001
page: 3
BIT 116: Scripting
Brian Bansenauer © 2001
TestAccount.html file Output
page: 4
Download