CSci 115: Computing and the Internet
Home Syllabus Assignments Tests

Assignment 2: Cash register

Due at:9:40am, Tue 11 Sep
Point value:30 pts

Write an XHTML page start.html and an XHTML/PHP file register.php, which together allow a user to enter a sequence of cash values, one per page. Each load of register.php should include the running totals, including the raw total of the items entered, the 6% sales tax that would be applied to these items, and the total including the sales tax.

The following sequence of example screen shots illustrates how your program might appear.

The user first loads the start.html page. Suppose the user enters 5 in the text field and presses the Enter button.

The register.php script generates the page to the left in response. The user might now enter 25 in the text field and press the Enter button.

You don't need to worry about checking to see whether the number the user enters is a valid number.

The new page generated by register.php displays the total of both items. The user can continue adding items to the receipt, one at a time, by entering each additional item in the text field and pressing Enter. The totals will be updated as each item is added.

Note that the above screen shots specify a minimum for how your page might appear; you don't need to stick slavishly to them, as long as the overal functionality is the same, including the raw total, sales tax, and grand total on each response. A small portion (10%) of your grade will depend on enhancements beyond this minimum, which could involve making the Web pages more attractive, or it could include enhancements to the PHP functionality.

Suggestion: Break this assignment into three parts. At first, don't worry about including the form in register.php that allows the user to enter the second and subsequent items: You'll just write start.html and the first part of register.php. Only after you've tested this thoroughly would you proceed to working on the form for entering subsequent items. And only then would you proceed to worrying about enhancements.

There are two simple pieces of HTML/PHP knowledge that I haven't mentioned to you yet, but which you will need for this assignment.

Submit your solution via Sauron. [Instructions]