See it yet?
Indeed, the price of those Kickers should probably be $6.30, not $6.3. Of course, as floating-point values, the two are arguably the same (imprecision of floats aside), but most people prefer their money formatted to two decimal places.
How to fix? Without seeing the code, it's hard to say for sure, but odds are the bug relates to improper use of a function like printf, which allows programmers to format numbers as they see fit. For instance, if f is a float, it can be formatted like money with printf in C as follows:
printf("%.2f", f);
The .2 tells printf to format the float to two decimal places. Of course, the site's probably not implemented in C (in which much of CS50 is taught). In fact, a quick glance at the site's URLs suggests it's implemented in Java (c.f. http://www.dominos.com/home/index.jsp) using JSP, which has its own version of printf as well as alternatives, including java.text.NumberFormat, java.text.DecimalFormat, and java.util.Currency. Of course, because of the imprecision of floats, they really shouldn't be used for money at all, unless Domino's is willing to lose (lots of) pennies over time. Better to store prices as cents or use some fixed-point data type (e.g., MySQL offers a DECIMAL data type that might help in this case).
Whatever the language or database in use, though, someone screwed up. And it shouldn't have been hard to fix! I suppose replacing Kickers with Chocolate Lava Crunch Cakes was, as they say, a workaround.
djm

Just on the side. If this page was implemented in PHP? Would it be more efficient to format the amount ($3.6) using number_format() or printf()?
chrisnwasike
04:47An interesting question. Though best to compare apples and apples: a better analog for number_format() is probably sprintf(), not printf(). Whereas printf() outputs to STDOUT, sprintf() returns a string just as number_format() does.
We could pull up PHP's source code for number_format() and sprintf() and hazard an analysis, but, in this case, an actual experiment might be more convincing. Let me propose two quick-and-dirty files:
number_format.php:
<?
$f = 6.3;
for ($i = 0; $i < 10000000; $i++)
number_format($f, 2);
?>
sprintf.php:
<?
$f = 6.3;
for ($i = 0; $i < 10000000; $i++)
sprintf("%.2f", $f);
?>
Let's time each's execution at a command line:
% /usr/bin/time /usr/bin/php sprintf.php
6.89 real 6.88 user 0.01 sys
% /usr/bin/time /usr/bin/php number_format.php
6.76 real 6.74 user 0.01 sys
At least in the context of this (somewhat reasonable but not terribly scientific) experiment, number_format() appears to perform ever so slightly better than sprintf() over 10 million iterations. (I saw similar numbers upon running these two tests multiple times, as well as with 100 million iterations.) As for which to use in practice, odds are you won't notice much difference in real-world applications. The source code might offer more helpful insights, though, as to what's going on underneath the hood in terms of cycles and memory consumed.
djm
malan
22:36Hi.. I'm following you for three years.
I'm watching your lesson video.
So thank you very much and I'm from Turkey ( :
Muhammed
12:14