Script 1.8
You are purchasing 30 eggplants at a cost of $ 1.95 each.
With tax, the total comes to $ 62.16.
Happy Parmigiana!
<?php # Script 1.8 - numbers.php // Set the variables: $quantity = 30; $item = 'eggplant'; $item .= ($quantity>1)?'s':''; $price = 1.95; //individual price $currency = '$ '; //currency symbol $taxrate = .0625; // MASS state sales tax. // Calculate the total: $total = $quantity * $price; $total = $total + ($total * $taxrate); // Calculate and add the tax. // Format the total: $total = number_format ($total, 2); // Print the results: echo '<p>You are purchasing <b>' . $quantity . '</b> <b>'.$item.'</b> at a cost of <b>'.$currency . $price . '</b> each.<br /> With tax, the total comes to <b>'.$currency . $total . '</b>.</p>'; echo '<p>Happy Parmigiana!</p>'; ?>