Transcript ppt

Assignment 4
November 23
Assignment 4
• Due December 5, 2005 in class by 1:30 pm
• You will be creating an order form and python
script to create a receipt from that order form
• This will be building on Assignment 2
• Do NOT edit your assignment 2 files online
– Make a copy of your assignment 2 folder and name it
assignment4. You can edit files in assignment4.
Order Form
• You will create an order form for your company website
• This order form should be part of the rest of your
company website
• You must use color and good organization
– You can use the stylesheet you already have
– Or write a new, simple one for this order form and receipt
– May want to make it have a light background instead of a dark
one (typical of order forms and online receipts)
• Hint, just use an internal stylesheet if you only want to change one
or two things
• Valid XHTML 1.0 strict with appropriate graphic link to
W3C validator at the bottom
Order Form Requirements
• Customer name
• Customer Address:
–
–
–
–
Street
City
Province (2 characters only)
Postal Code (6 characters only)
• Credit Card information:
– 16 digit credit card number
– Type (AMEX, Visa, MC, etc)
– Expiration Date
Order Form, cont.
• You must have 5 products on your order form
– If you only have 3 in your main website make up 2
new ones. You do not have to add these products to
your website, only the order form
• You should allow the user to order anywhere
from 0 to 999 of your items (think 3 characters)
• You must display the price of the item and it’s
name
– Description is optional
Order Form,cont.
• You must provide at least the following 2
checkboxes:
– If they want the items gift-wrapped or sent as a gift
item
• One checkbox for the entire order is sufficient
– If they want to be notified when the product ships (or
when the order is received, or processed)
• A submit button to send in their order.
– You must specify the <form action = “URL of script” in
order for the button to work
Python Script
• Will execute when the user presses the
submit button
– Put it into the same folder as your HTML files
for assignment 4
• Purpose is to produce a receipt for the
user
– Outputs a new HTML page
• Has lots of small requirements
Script Requirements
• The receipt your script produces must
have the following components:
– Customer Name
– Shipping Address
– Credit card information: Type, expiration date,
and credit card number in this format: xxxxxxxx-xxxx-1234
• Show only the last 4 digits
• The receipt must also show pricing
information
Script and Pricing Information
• Your script will have to calculate a number of
price values
• You need to display the products they ordered,
the number of items they ordered, the cost of
each item, and the total cost
– 2 t-shirts at $10 a piece is $20
• If the user selected gift-wrapping you need to
calculate $2 per each item
– If they ordered 2 t-shits, 4 televisions, and 1 can
opener: the total gift-wrapping cost is $14
– Show this value
Pricing, cont.
• If the user spends more than $150, you need to
calculate a 15% discount
– Show the amount they will receive off of their total
price
– If the user spends $200, then you need to display the
value of $30 for their discount
• If the user is from BC, show 14% sales tax.
– If they are from AB, show 9% sales tax
– Otherwise sales tax is 7.5%
– This is calculated once you have taken the total price
of their goods + giftwrapping – discount.
• (goodsValue+giftwrapping – discount) * salesTax
Pricing cont.-shipping
• You also need to display shipping cost
– If the user is from BC, shipping cost is $5.00
– If they are from AB, shipping cost is $6.00
– Otherwise, $10.00
Pricing Overall
• Each item ordered with name, number, cost per
item, total cost
• Sub total of all items ordered (just add the total
costs from the previous list-item)
• Cost of gift-wrapping
• Amount of discount
• Amount of sales tax
• Amount of shipping and handling
• Total cost for the order
Other Items needed on Receipt
• If the user selected email notification, you
must print a statement saying they will be
notified when the order has shipped (or
been processed, etc.)
• You must also thank them for purchasing
your goods
– Can also include a statement about returns
– Or for questions, contact:……
General Script Requirements
• The page output by your python script should be
valid XHTML
– Don’t get sloppy
• You must write at least 2 functions of your own
• For the province information of the address, you
should accept any combination of upper and
lowercase characters for BC and AB
– BC, bC, Bc, bc, AB, aB, Ab, ab
Paper Requirements
• You must submit a paper portion with this
assignment:
– Printed copy of python script
– Printed copy of your HTML order form
– Screenshot of your order form
– Screenshot of sample order
– Copy of marking sheet (sent out next week)
General Requirements
• Add a link to your index.html to the main page of
your company site
– NOT the order form
• Edit your website to include a link to your order
form
– Don’t forget that on the order form you may want to
have links back to the shopping section of your site
(instead of hitting back button)
• All files should be in a folder called assignment4
(pictures in subdirectory)
Submission Requirements
• Upload all files to the cmpt165 course
server
• Submit a zipped version of your
assignment 4 directory to the submission
server
• Submit the paper copy in class
• This is due the last regular day of class
– Please try not to be late
– Get help if you need it
Assignment 4, cont.
• Assignment 4 will be posted after class
today
• We have not really covered in depth using
CGI to access form information
– We’ll do this on Friday when we have an
network connection
• But, you can start work on your form