HW6: Bookstore

Due

3/21 Monday 5 pm. Notice that the lab is closed after 3/16

Description

You are going to write a very simple CGI program. The CGI program compute the total cost of your books. If there is some invalid input, the program will print out warning message in red and ask for new input.

Here is how your webpage look like

Charles Bookstore

Book Price Quantity
Learning Perl $34.95
Perl Cookbook $49.95
Perl in a Nutshell $39.95
Programming Perl $49.95

Are you a member? Yes No

If yes, please type in membership number:

The user type in the quatity of the books. The final price is calculated, for example if 2 Learning Perl and 3 Perl in a Nutshell are bought.

You bought 2 Learning Perl and 3 Perl in a Nutshell.
The total cost is $189.75

If the user choose yes to the membership and enter a valid membership number Then, the use get 10% discount. The output is

You bought 2 Learning Perl and 3 Perl in a Nutshell.
As a member, you get 10% discount!
The total cost is $189.75

So far, my bookstores have only 9 members, here are their 9-digit membership number: 111222333,222333444,333444555,444555666,555666777,666777888,777888999,123456789, 987654321

When the user input invalid data, then a warning message in red will be given.

Charles Bookstore

Sorry, we cannot process your request due to the following reasons:

please enter integers for the quantities.

Book Price Quantity
Learning Perl $34.95
Perl Cookbook $49.95
Perl in a Nutshell $39.95
Programming Perl $49.95

Are you a member? Yes No

Invalid membership number.

If yes, please type in membership number:

Changes

What to submit

There is nothing to submit. The grader is going to check your webpages
http://www.pic.ucla.edu/~YourUserName/hw6/index.html. You should name your CGI program book.cgi. You have to chmod 711 book.cgi. You will get zero point if your CGI file is readable by other people.

Remark

Don't forget to put your honesty pledge inside your html file (between <body> and <body/>)

<!--
Name:        Charles Li 
Student ID : 000 000 000   
PIC ID:      ccli 
E-mail:      ccli AT math DOT ucla DOT edu 
Assignment:	 hw1 
I, Charles Li, pledge that this is my own independent work, which  
conforms to the guidelines of academic honesty as described in the course  
syllabus.  
-->

and in your cgi file add

 # Name:		Charles Li
 # Student ID:		000 000 000
 # PIC ID:		ccli
 # E-mail:		ccli@math.ucla.edu
 # Assignment:		hw1
 #
 # I, Charles Li, pledge that this is my own independent work, which 
 # conforms to the guidelines of academic honesty as described in the course 
 # syllabus.