Jump to content
Larry Ullman's Book Forums

Chapter 3 - Page 106 - Script 3.10 Calculator.Php #5


Recommended Posts

Hi guys,

 

I've been going over chapter 3 today, script 3.10 calculator.php #5 and unless I'm being stupid (most likely) is their an error on line 30 ?

 

Instead of (Larrys code):

 

// Get the cost of those gallons

$dollars = $gallons / $ppg;

 

Should it not be:

 

// Get the cost of those gallons

$dollars = $gallons * $ppg;

 

After completing the Script and running the results (submitting the form data) using $dollars = $gallons / $ppg; this just did not look right:

 

Total Estimated Cost:

 

The total cost of driving 300 miles, averaging 30 miles per gallon, and paying an average of $3.00 per gallon, is $3.33. If you drive at an average of 65 miles per hour, the trip will take approximately 4.62 hours.

 

Sorry if this has been answered elsewhere (I did check the errata but it contained no reference). But I just thought I'd bring it up, and make sure I'm not having a braindead moment :)

 

Cheers

Link to comment
Share on other sites

 Share

×
×
  • Create New...