IS 341: Project 9 Solution
25 HW points, 25 PDP points


Homework

Most everyone got the lab page pretty much working, though several people failed to program the reset button to reset the prices as well as the quantities, and no one completely fixed the bug that was described in the project spec.

The following segment of code is where the bug lies. It says that if quantity is not a number, don't recompute the line total:

if (!isNaN(price) && !isNaN(quantity)) {
  total = price * quantity;

  the rest of the code
This turns out to be incorrect. If the price is not a number, then we really don't want to recompute the line total, but if the quantity is not a number, then we should treat its value as 0. The following small modification will fix this:
if (!isNaN(price)) {
  if (!isNaN(quantity))
    total = price * quantity;
  else
    total = 0;

  the rest of the code

Personal Database Project

Here, I wanted to see some sort of page with input value checking. I wasn't too picky about what I saw.


Last modified: Thu Nov 20 16:01:53 Eastern Standard Time 2003
© 2003 Calvin College