Created
May 5, 2009 17:35
-
-
Save Drarok/107074 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<HTML> | |
<HEAD> | |
<TITLE>Volume Discount</TITLE> | |
<SCRIPT LANGUAGE = "JavaScript"> | |
// A program to tell a customer what volume discount they can expect. | |
var numberOfGiftBoxes = window.prompt('Please enter now many boxes you are purchasing.', ''); | |
var boxes = parseFloat(numberOfGiftBoxes); | |
if (isNaN(boxes)) | |
{ | |
alert('Invalid value for boxes. Please enter a number.') | |
} | |
else | |
{ | |
var discount; | |
if (boxes <= 3) | |
{ | |
discount = 'No Discount'; | |
} | |
else if (numberOfGiftBoxes <= 11) | |
{ | |
discount = '5% Bulk Purchase Discount'; | |
} | |
else if (numberOfGiftBoxes <= 30) | |
{ | |
discount = '10% Bulk Purchase Discount'; | |
} | |
else | |
{ | |
discount = '20% Bulk Purchase Discount'; | |
} | |
document.write(discount); | |
} | |
</SCRIPT> | |
</HEAD> | |
<BODY> | |
</BODY> | |
</HTML> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment